Exemplo n.º 1
0
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));
}
Exemplo n.º 2
0
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 );
}
Exemplo n.º 3
0
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 );
}
Exemplo n.º 4
0
// ////////////////////////////////////////////////////////////////////////////
TimeT TimeVal::ToTimeT() const
{
	return(TimeT(tv_sec));
}