void stamp_time(timestamp_milliseconds_buffer& out) { struct timeval tv; gettimeofday(&tv, NULL); struct tm when = TimeT(tv.tv_sec); char buf[24]; strftime(buf, 20, "%Y-%m-%d %H:%M:%S", &when); sprintf(buf + 19, ".%03d", static_cast<int>(tv.tv_usec / 1000)); out = stringish<timestamp_milliseconds_buffer>(const_(buf)); }
TimeT appGetGMTTime() { time_t rawtime; tm * timeinfo; // Get the raw time, convert it to GMT time and return the result time( &rawtime ); timeinfo = gmtime( &rawtime ); return TimeT( rawtime, timeinfo ); }
TimeT appGetLocaltime() { time_t rawtime; tm * timeinfo; // Get the raw time, convert it to local time and return the result time( &rawtime ); timeinfo = localtime( &rawtime ); return TimeT( rawtime, timeinfo ); }
// //////////////////////////////////////////////////////////////////////////// TimeT TimeVal::ToTimeT() const { return(TimeT(tv_sec)); }