view src/timeconv.c @ 182:b65e8d0a088a

more cleanup on external names in the shared object file
author Carl Byington <carl@five-ten-sg.com>
date Mon, 13 Apr 2009 11:39:33 -0700
parents 6954d315aaa8
children 7c60d6d1c681
line wrap: on
line source

#include "define.h"



char * pst_fileTimeToAscii(const FILETIME* filetime) {
    time_t t;
    t = pst_fileTimeToUnixTime(filetime);
    return ctime(&t);
}


struct tm * pst_fileTimeToStructTM (const FILETIME *filetime) {
    time_t t1;
    t1 = pst_fileTimeToUnixTime(filetime);
    return gmtime(&t1);
}


time_t pst_fileTimeToUnixTime(const FILETIME *filetime)
{
    int64_t t = filetime->dwHighDateTime;
    t <<= 32;
    t += filetime->dwLowDateTime;
    t -= 116444736000000000LL;
    if (t < 0) {
        return -1 - ((-t - 1) / 10000000);
    }
    else {
        return t / 10000000;
    }
}