Umasoft
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
vtTime.h
1 //
2 // vtTime.h
3 //
4 // Copyright (c) 2004 Virtual Terrain Project
5 // Free for all uses, see license.txt for details.
6 //
7 
8 #ifndef VTTIMEH
9 #define VTTIMEH
10 
11 #include <time.h>
12 #include "vtString.h"
13 
15 
32 class vtTime
33 {
34 public:
35  vtTime();
36 
37  void SetDate(int year, int month, int day);
38  void GetDate(int &year, int &month, int &day) const;
39 
40  void SetTimeOfDay(int hr, int min, int sec);
41 
42  void GetTimeOfDay(int &hr, int &min, int &sec) const;
43  int GetSecondOfDay() const;
44 
45  time_t GetTime() const;
46  const tm &GetTM() const { return m_tm; }
47  void Increment(int secs);
48 
49  bool SetFromString(const vtString &str);
50  vtString GetAsString();
51 
52  void GetSystemTime();
53 
54 protected:
55  void _UpdateTM();
56 
57  tm m_tm;
58  time_t m_time;
59 
60 // static time_t s_DifferenceFromGMT;
61 };
62 
63 #endif // VTTIMEH
64