InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
GlobalTime Class Reference

#include <GlobalTime.h>

Public Types

enum  { kOneSecond = 10000000 }
 
typedef object_type data_type
 

Public Member Functions

 GlobalTime (uint64 time)
 
void SetTime (uint64 time)
 
int32 SetTime (int32 year, int32 month, int32 day, int32 hour, int32 minute, int32 second)
 
uint64 GetTime () const
 
int32 GetTime (int32 *year, int32 *month, int32 *day, int32 *hour, int32 *minute, int32 *second, int32 *dayOfWeek=nil) const
 
void CurrentTime ()
 
int32 DateToString (PMString &s, bool16 shortform) const
 
int32 TimeToString (PMString &s) const
 
void ReadWrite (IPMStream *s)
 
bool16 IsHistory (uint64 timeinterval) const
 
bool16 operator== (const GlobalTime &gt) const
 
bool16 operator!= (const GlobalTime &gt) const
 
bool16 operator< (const GlobalTime &gt) const
 
bool16 operator> (const GlobalTime &gt) const
 

Detailed Description

NOTE: Do not use GlobalTime for new code, please use IDTime instead. GlobalTime has problems with time on the Mac due to the way daylight savings time is handled.

GlobalTime provides time features in a core way.

GlobalTime is based on a uint64 bit number. It matches NT's FILETIME, the number of 100 nanoseconds since January 1, 1601, and it is UTC based.

See Also
IDTime
Author
Steve Flenniken

Member Enumeration Documentation

anonymous enum

Value that represents one second.

Constructor & Destructor Documentation

GlobalTime::GlobalTime (uint64 time)
inline

Method to set the stored time to the specified time value.

Parameters
timeis the value to set. It is equivalent to NT's FILETIME.

Member Function Documentation

void GlobalTime::CurrentTime ()

Method to set the stored time to the current time.

int32 GlobalTime::DateToString (PMStrings,
bool16 shortform 
) const

Method to get a date string that represents the stored GlobalTime. The string returned is dependent on your system and system's settings.

Parameters
sis the string to fill in.
shortformis true then you get a short date string, otherwise you get a long date string.
Returns
0 the method was successful, otherwise return non-zero.
uint64 GlobalTime::GetTime () const
inline

Method to get the uint64 GlobalTime value.

Returns
a uint64 that represents the GlobalTime value.
int32 GlobalTime::GetTime (int32 * year,
int32 * month,
int32 * day,
int32 * hour,
int32 * minute,
int32 * second,
int32 * dayOfWeek = nil 
) const

Method to get the time components that the GlobalTime represents. All parameters are optional, pass nil when you do not want a value. See SetTime for the parameter meanings.

Parameters
yearvalue to get
monthvalue to get
dayvalue to get
hourvalue to get
minutevalue to get
secondvalue to get
dayof week (e.g. Tuesday) value to get (1 = Sunday.. 7 = Saturday)
Returns
0 the method was successful, otherwise return non-zero.
bool16 GlobalTime::IsHistory (uint64 timeinterval) const

Method to determine whether the stored time plus the specified time is in the past.

Parameters
timeintervalis the time value to add to the current stored time. You can use kOneSecond for the timeinterval parameter.
Returns
true when the value is in the past.
bool16 GlobalTime::operator!= (const GlobalTimegt) const
inline

Method to determine whether two GlobalTime values are not equal.

Returns
true when the values are not equal.
bool16 GlobalTime::operator< (const GlobalTimegt) const
inline

Method to determine whether two GlobalTime values are less than each other.

Returns
true when the values are less than each other.
bool16 GlobalTime::operator== (const GlobalTimegt) const
inline

Method to determine whether two GlobalTime values are equal.

Returns
true when the values are equal.
bool16 GlobalTime::operator> (const GlobalTimegt) const
inline

Method to determine whether two GlobalTime values are greater than each other.

Returns
true when the values are greater than each other.
void GlobalTime::ReadWrite (IPMStreams)

Method to stream out the GlobalTime value.

Parameters
sis the stream to write to.
void GlobalTime::SetTime (uint64 time)
inline

Method to set the stored time to the specified time value.

Parameters
timeis the value to set. It is equivalent to NT's FILETIME.
int32 GlobalTime::SetTime (int32 year,
int32 month,
int32 day,
int32 hour,
int32 minute,
int32 second 
)

Method to set the stored time to the specified time value.

Parameters
yearis a year value, for example 2005. The year must be greater than 1601.
monthis a value from 1 to 12, where January = 1, February = 2, and so on.
dayis the day of the week. A value from 0 to 6 where Sunday = 0, Monday = 1, and so on.
houris the current hour in 24 hour time.
minuteis the current minute.
secondis the current second.
Returns
0 the method was successful, otherwise return non-zero.
int32 GlobalTime::TimeToString (PMStrings) const

Method to get a time string that represents the stored GlobalTime. The string returned is dependent on your system and system's settings.

Parameters
sis the string to fill in.
Returns
0 the method was successful, otherwise return non-zero.