version 1.74, 2006/09/15 17:42:28
|
version 1.75, 2006/09/26 17:24:06
|
|
|
// | // |
//============================================================================== | //============================================================================== |
| |
#if defined(PEGASUS_OS_TYPE_UNIX) |
#if defined(PEGASUS_OS_TYPE_UNIX) || defined(PEGASUS_OS_VMS) |
| |
CIMDateTime CIMDateTime::getCurrentDateTime() | CIMDateTime CIMDateTime::getCurrentDateTime() |
{ | { |
|
|
// ATTN: if this fails on your platform, use time() to obtain the | // ATTN: if this fails on your platform, use time() to obtain the |
// sec element and set usec to zero. | // sec element and set usec to zero. |
struct timeval tv; | struct timeval tv; |
|
#if defined(PEGASUS_OS_VMS) |
|
void *tz = NULL; |
|
#else |
struct timezone tz; | struct timezone tz; |
|
#endif |
gettimeofday(&tv, &tz); | gettimeofday(&tv, &tz); |
sec = tv.tv_sec; | sec = tv.tv_sec; |
usec = Uint64(tv.tv_usec); | usec = Uint64(tv.tv_usec); |
|
|
// Assume 1 hour. | // Assume 1 hour. |
tzMinutesEast += 60; | tzMinutesEast += 60; |
} | } |
# elif defined(PEGASUS_OS_LINUX) |
# elif defined(PEGASUS_OS_LINUX) || defined(PEGASUS_OS_VMS) |
tzMinutesEast = (int) tmval->tm_gmtoff/60; | tzMinutesEast = (int) tmval->tm_gmtoff/60; |
# else | # else |
if (tz.tz_dsttime > 0) | if (tz.tz_dsttime > 0) |
|
|
| |
//============================================================================== | //============================================================================== |
// | // |
// PEGASUS_OS_VMS |
|
// |
|
//============================================================================== |
|
|
|
#if defined(PEGASUS_OS_VMS) |
|
|
|
CIMDateTime CIMDateTime::getCurrentDateTime() |
|
{ |
|
time_t mSysTime; |
|
struct tm* tmval; |
|
|
|
// Get time. |
|
|
|
mSysTime = time(NULL); |
|
|
|
// Get the localtime |
|
|
|
tmval = localtime(&mSysTime); |
|
|
|
// Initialize components. |
|
|
|
Uint32 year = 1900 + tmval->tm_year; |
|
Uint32 month = tmval->tm_mon + 1; |
|
Uint32 day = tmval->tm_mday; |
|
Uint32 hours = tmval->tm_hour; |
|
Uint32 minutes = tmval->tm_min; |
|
Uint32 seconds = tmval->tm_sec; |
|
|
|
// ATTN: missing UTC offset here. |
|
|
|
return CIMDateTime(year, month, day, hours, minutes, seconds, 0, 6, 0); |
|
} |
|
|
|
#endif /* PEGASUS_OS_VMS */ |
|
|
|
//============================================================================== |
|
// |
|
// PEGASUS_OS_TYPE_WINDOWS | // PEGASUS_OS_TYPE_WINDOWS |
// | // |
//============================================================================== | //============================================================================== |