InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
GlobalTime.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Steve Flenniken
6 //
7 // $Author$
8 //
9 // $DateTime$
10 //
11 // $Revision$
12 //
13 // $Change$
14 //
15 // Copyright 1997-2010 Adobe Systems Incorporated. All rights reserved.
16 //
17 // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
18 // with the terms of the Adobe license agreement accompanying it. If you have received
19 // this file from a source other than Adobe, then your use, modification, or
20 // distribution of it requires the prior written permission of Adobe.
21 //
22 //========================================================================================
23 
24 #ifndef __GlobalTime__
25 #define __GlobalTime__
26 
27 // Forward declare
28 class PMString;
29 
30 
45 {
46 public:
47  typedef object_type data_type;
48 
51  enum {kOneSecond = 10000000};
52 
53  GlobalTime(){fTime = 0;};
54 
58  GlobalTime(uint64 time) {SetTime(time);};
59 
60 #if MACINTOSH
61 
65  GlobalTime(uint32 macseconds) {SetTime(macseconds);};
66 #endif
67 
68  ~GlobalTime();
69 
73  void SetTime(uint64 time) {fTime = time;};
74 
84  int32 SetTime(int32 year, int32 month, int32 day, int32 hour,
85  int32 minute, int32 second);
86 
87 #if MACINTOSH
88 
92  void SetTime(uint32 macseconds);
93 
99  uint64 MacSecondsToFileTime(uint32 macseconds) const;
100 
105  uint32 FileTimeToMacSeconds(uint64 time) const;
106 #endif
107 
111  uint64 GetTime() const {return fTime;};
112 
125  int32 GetTime(int32 *year, int32 *month, int32 *day, int32 *hour,
126  int32 *minute, int32 *second, int32* dayOfWeek = nil) const;
127 
130  void CurrentTime();
131 
138  int32 DateToString(PMString &s, bool16 shortform) const;
139 
145  int32 TimeToString(PMString &s) const;
146 
150  void ReadWrite(IPMStream *s);
151 
157  bool16 IsHistory(uint64 timeinterval) const;
158 
162  bool16 operator == (const GlobalTime &gt) const {return fTime == gt.fTime;};
163 
167  bool16 operator != (const GlobalTime &gt) const {return fTime != gt.fTime;};
168 
172  bool16 operator < (const GlobalTime &gt) const {return fTime < gt.fTime;};
173 
177  bool16 operator > (const GlobalTime &gt) const {return fTime > gt.fTime;};
178 
179 #if DEBUG
180 
183  bool16 Test() const;
184 #endif
185 
186 private:
187  uint64 GetCurrentSystemTime() const;
188  uint64 XferInt64(IPMStream *s, uint64 &value) const;
189 
190 #if MACINTOSH
191  int32 GetGMTDelta() const;
192 #endif
193 
194  uint64 fTime;
195 };
196 
197 
198 #endif