comparison 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
comparison
equal deleted inserted replaced
197:07ceebd115ce 198:7c60d6d1c681
16 } 16 }
17 17
18 18
19 time_t pst_fileTimeToUnixTime(const FILETIME *filetime) 19 time_t pst_fileTimeToUnixTime(const FILETIME *filetime)
20 { 20 {
21 int64_t t = filetime->dwHighDateTime; 21 uint64_t t = filetime->dwHighDateTime;
22 const uint64_t bias = 11644473600LL;
22 t <<= 32; 23 t <<= 32;
23 t += filetime->dwLowDateTime; 24 t += filetime->dwLowDateTime;
24 t -= 116444736000000000LL; 25 t /= 10000000;
25 if (t < 0) { 26 t -= bias;
26 return -1 - ((-t - 1) / 10000000); 27 return ((t > (uint64_t)0x000000007fffffff) && (sizeof(time_t) <= 4)) ? 0 : (time_t)t;
27 }
28 else {
29 return t / 10000000;
30 }
31 } 28 }
32 29