Mercurial > libpst
annotate src/timeconv.c @ 185:e0392999e9b8
Added tag stable-0-6-36 for changeset 05dc6892d7e4
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Mon, 13 Apr 2009 15:55:55 -0700 |
parents | b65e8d0a088a |
children | 7c60d6d1c681 |
rev | line source |
---|---|
122
bdb38b434c0a
more changes from Fridrich Strba to avoid installing our config.h
Carl Byington <carl@five-ten-sg.com>
parents:
118
diff
changeset
|
1 #include "define.h" |
bdb38b434c0a
more changes from Fridrich Strba to avoid installing our config.h
Carl Byington <carl@five-ten-sg.com>
parents:
118
diff
changeset
|
2 |
182
b65e8d0a088a
more cleanup on external names in the shared object file
Carl Byington <carl@five-ten-sg.com>
parents:
172
diff
changeset
|
3 |
16 | 4 |
182
b65e8d0a088a
more cleanup on external names in the shared object file
Carl Byington <carl@five-ten-sg.com>
parents:
172
diff
changeset
|
5 char * pst_fileTimeToAscii(const FILETIME* filetime) { |
b65e8d0a088a
more cleanup on external names in the shared object file
Carl Byington <carl@five-ten-sg.com>
parents:
172
diff
changeset
|
6 time_t t; |
b65e8d0a088a
more cleanup on external names in the shared object file
Carl Byington <carl@five-ten-sg.com>
parents:
172
diff
changeset
|
7 t = pst_fileTimeToUnixTime(filetime); |
b65e8d0a088a
more cleanup on external names in the shared object file
Carl Byington <carl@five-ten-sg.com>
parents:
172
diff
changeset
|
8 return ctime(&t); |
16 | 9 } |
10 | |
182
b65e8d0a088a
more cleanup on external names in the shared object file
Carl Byington <carl@five-ten-sg.com>
parents:
172
diff
changeset
|
11 |
172
6954d315aaa8
move version-info into main configure.in, and set it properly.
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
12 struct tm * pst_fileTimeToStructTM (const FILETIME *filetime) { |
6954d315aaa8
move version-info into main configure.in, and set it properly.
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
13 time_t t1; |
182
b65e8d0a088a
more cleanup on external names in the shared object file
Carl Byington <carl@five-ten-sg.com>
parents:
172
diff
changeset
|
14 t1 = pst_fileTimeToUnixTime(filetime); |
172
6954d315aaa8
move version-info into main configure.in, and set it properly.
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
15 return gmtime(&t1); |
16 | 16 } |
17 | |
182
b65e8d0a088a
more cleanup on external names in the shared object file
Carl Byington <carl@five-ten-sg.com>
parents:
172
diff
changeset
|
18 |
b65e8d0a088a
more cleanup on external names in the shared object file
Carl Byington <carl@five-ten-sg.com>
parents:
172
diff
changeset
|
19 time_t pst_fileTimeToUnixTime(const FILETIME *filetime) |
16 | 20 { |
182
b65e8d0a088a
more cleanup on external names in the shared object file
Carl Byington <carl@five-ten-sg.com>
parents:
172
diff
changeset
|
21 int64_t t = filetime->dwHighDateTime; |
16 | 22 t <<= 32; |
182
b65e8d0a088a
more cleanup on external names in the shared object file
Carl Byington <carl@five-ten-sg.com>
parents:
172
diff
changeset
|
23 t += filetime->dwLowDateTime; |
16 | 24 t -= 116444736000000000LL; |
182
b65e8d0a088a
more cleanup on external names in the shared object file
Carl Byington <carl@five-ten-sg.com>
parents:
172
diff
changeset
|
25 if (t < 0) { |
b65e8d0a088a
more cleanup on external names in the shared object file
Carl Byington <carl@five-ten-sg.com>
parents:
172
diff
changeset
|
26 return -1 - ((-t - 1) / 10000000); |
16 | 27 } |
182
b65e8d0a088a
more cleanup on external names in the shared object file
Carl Byington <carl@five-ten-sg.com>
parents:
172
diff
changeset
|
28 else { |
b65e8d0a088a
more cleanup on external names in the shared object file
Carl Byington <carl@five-ten-sg.com>
parents:
172
diff
changeset
|
29 return t / 10000000; |
16 | 30 } |
31 } | |
118
0f1492b7fe8b
patch from Fridrich Strba for building on mingw and general cleanup of autoconf files
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
32 |