summaryrefslogtreecommitdiff
path: root/ptw32_timespec.c
diff options
context:
space:
mode:
authorrpj <rpj>2011-06-29 06:19:26 +0000
committerrpj <rpj>2011-06-29 06:19:26 +0000
commit5fdebbca2831af55fcd17d1819ec68dc17e2ec58 (patch)
treeafc3ee148258f406a98c78e801b5c58ef551ac00 /ptw32_timespec.c
parent3f334b78ab4447a37ed40b34c5fdd1aac76d3df7 (diff)
See the ChangeLog
Diffstat (limited to 'ptw32_timespec.c')
-rw-r--r--ptw32_timespec.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/ptw32_timespec.c b/ptw32_timespec.c
index c448645..6318957 100644
--- a/ptw32_timespec.c
+++ b/ptw32_timespec.c
@@ -45,7 +45,7 @@
* time between jan 1, 1601 and jan 1, 1970 in units of 100 nanoseconds
*/
#define PTW32_TIMESPEC_TO_FILETIME_OFFSET \
- ( ((LONGLONG) 27111902 << 32) + (LONGLONG) 3577643008 )
+ ( ((int64_t) 27111902 << 32) + (int64_t) 3577643008 )
INLINE void
ptw32_timespec_to_filetime (const struct timespec *ts, FILETIME * ft)
@@ -58,7 +58,7 @@ ptw32_timespec_to_filetime (const struct timespec *ts, FILETIME * ft)
* -------------------------------------------------------------------
*/
{
- *(LONGLONG *) ft = ts->tv_sec * 10000000
+ *(int64_t *) ft = ts->tv_sec * 10000000
+ (ts->tv_nsec + 50) / 100 + PTW32_TIMESPEC_TO_FILETIME_OFFSET;
}
@@ -74,10 +74,10 @@ ptw32_filetime_to_timespec (const FILETIME * ft, struct timespec *ts)
*/
{
ts->tv_sec =
- (int) ((*(LONGLONG *) ft - PTW32_TIMESPEC_TO_FILETIME_OFFSET) / 10000000);
+ (int) ((*(int64_t *) ft - PTW32_TIMESPEC_TO_FILETIME_OFFSET) / 10000000);
ts->tv_nsec =
- (int) ((*(LONGLONG *) ft - PTW32_TIMESPEC_TO_FILETIME_OFFSET -
- ((LONGLONG) ts->tv_sec * (LONGLONG) 10000000)) * 100);
+ (int) ((*(int64_t *) ft - PTW32_TIMESPEC_TO_FILETIME_OFFSET -
+ ((int64_t) ts->tv_sec * (int64_t) 10000000)) * 100);
}
#endif /* NEED_FTIME */