Mercurial > libpst
diff src/timeconv.c @ 198:7c60d6d1c681
decode more recurrence mapi elements
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Tue, 12 May 2009 19:34:49 -0700 |
parents | b65e8d0a088a |
children | e3a46f66332b |
line wrap: on
line diff
--- a/src/timeconv.c Wed May 06 10:37:46 2009 -0700 +++ b/src/timeconv.c Tue May 12 19:34:49 2009 -0700 @@ -18,15 +18,12 @@ time_t pst_fileTimeToUnixTime(const FILETIME *filetime) { - int64_t t = filetime->dwHighDateTime; + uint64_t t = filetime->dwHighDateTime; + const uint64_t bias = 11644473600LL; t <<= 32; t += filetime->dwLowDateTime; - t -= 116444736000000000LL; - if (t < 0) { - return -1 - ((-t - 1) / 10000000); - } - else { - return t / 10000000; - } + t /= 10000000; + t -= bias; + return ((t > (uint64_t)0x000000007fffffff) && (sizeof(time_t) <= 4)) ? 0 : (time_t)t; }