160 return ((
utv.tv_sec == t.
utv.tv_sec) &&
161 (
utv.tv_usec == t.
utv.tv_usec));
166 if (
utv.tv_sec == t.
utv.tv_sec)
167 return (
utv.tv_usec < t.
utv.tv_usec);
169 return (
utv.tv_sec < t.
utv.tv_sec);
174 if (
utv.tv_sec == t.
utv.tv_sec)
175 return (
utv.tv_usec > t.
utv.tv_usec);
177 return (
utv.tv_sec > t.
utv.tv_sec);
181 const char *fmt =
"%c";
183 strftime(buf,
sizeof(buf), fmt, localtime(&t.
utv.tv_sec));
194#define EPOCH_DIFF 0x00dcddb30f2f8000ULL
212 const char *offstr = getenv(
"PSI_TZ");
215 offset = strtol(offstr, &err, 0);
216 if (err != 0 && *err !=
'\0') {
228 struct tm *tm = localtime(&time);
229 offset -= tm->tm_gmtoff;
230 offset += 3600 * tm->tm_isdst * 2;
261 utv.tv_sec = micro / 1000000;
262 utv.tv_usec = micro % 1000000;
266 uint64_t micro = (uint64_t)
utv.tv_sec * 1000000ULL +
utv.tv_usec;
Psion time related utility class.
bool operator==(const PsiTime &t)
Comparison operators.
~PsiTime()
Destroys the instance.
bool operator>(const PsiTime &t)
uint32_t getPsiTimeHi(void)
Retrieves the instance's current value in Psion time format, low 32 bits.
void setPsiZone(psi_timezone *_ptz)
Sets the Psion time zone of this instance.
psi_timeval & getPsiTimeval(void)
Retrieves the instance's current value in Psion time format.
PsiTime & operator=(const PsiTime &t)
Assignment operator.
uint32_t getPsiTimeLo(void)
Retrieves the instance's current value in Psion time format, high 32 bits.
uint32_t getSiboTime()
Retrieves the instance's current value in SIBO time format.
void setUnixNow(void)
Sets the value of this instance to the current time of the Unix machine.
bool operator<(const PsiTime &t)
void setSiboTime(uint32_t stime)
Modifies the value of this instance.
time_t getTime(void)
Retrieves the instance's current value in Unix time format.
void setUnixTime(struct timeval *_utv)
Sets the value of this instance.
PsiTime(void)
Constructs a new instance, initializing to now.
struct timeval & getTimeval(void)
Retrieves the instance's current value in Unix time format.
void setPsiTime(psi_timeval *_ptv)
Modifies the value of this instance.
A singleton wrapper for a psi_timezone .
void setZone(psi_timezone &ptz)
bool getZone(psi_timezone &ptz)
Retrieve the Psion time zone.
PsiZone()
Private constructor.
static PsiZone * _instance
This objects instance (singleton)
static PsiZone & getInstance()
Retrieve the singleton object.
static long long evalOffset(psi_timezone ptz, time_t time, bool valid)
ostream & operator<<(ostream &s, const PsiTime &t)
#define EPOCH_DIFF
The difference between EPOC epoch (01.01.0001 00:00:00) and Unix epoch (01.01.1970 00:00:00) in micro...
Holds a Psion time value.
uint32_t tv_low
The lower 32 bits.
uint32_t tv_high
The upper 32 bits.
holds a Psion time zone description.