/*time_t*/ long mktime(/*struct tm*/ void *timp) { #if !CAM_DRYOS return _mktime(timp); #else int timp_ext[10]; // struct tm + a ptr _memcpy(timp_ext,timp,9*sizeof(int)); timp_ext[9]=0; long retval = _mktime_ext(&timp_ext); _memcpy(timp,timp_ext,9*sizeof(int)); return retval; #endif }
int main() { time_t t1, t2; struct tm tm1, tm2; time( &t1 ); tm1 = *localtime(&t1); t1 = mktime(&tm1); tm1 = *gmtime(&t1); _time( &t2 ); tm2 = *_localtime(&t2); t2 = _mktime(&tm2); tm2 = *_gmtime(&t2); // time, mktime if( t1==t2 ) OutputDebugString( "ok\n" ); else { static char buf[128]; wsprintf( buf, "ng : %d, %d\n", t1, t2 ); OutputDebugString( buf ); } // localtime, gmtime if( 0==memcmp( &tm1, &tm2, sizeof(struct tm) ) ) OutputDebugString( "ok\n" ); else OutputDebugString( "ng\n" ); // ctime OutputDebugString( ctime(&t1) ); OutputDebugString( _ctime(&t2) ); // asctime OutputDebugString( asctime(&tm1) ); OutputDebugString( _asctime(&tm2) ); return 0; }