summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-01-12 02:48:37 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:17:03 -0500
commitec4384913415a64f9b95fa679692800d2dc6afd4 (patch)
tree0ec304fa5d6c60cfca238a1128bfcc1d0303cf7f
parent5a2585416c10216bd1097e7e369476dce780f776 (diff)
downloadsamba-ec4384913415a64f9b95fa679692800d2dc6afd4.tar.gz
samba-ec4384913415a64f9b95fa679692800d2dc6afd4.tar.bz2
samba-ec4384913415a64f9b95fa679692800d2dc6afd4.zip
r20694: To get this right we need to do signed 64-bit
comparisons here, not unsigned as we're eventually casting into what it normall a signed 32 bit value. Guenther please check (but I think I'm right here). Jeremy. (This used to be commit 31f8e0edc0c3e76654728b2c204faa70830e1f1b)
-rw-r--r--source3/lib/time.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/source3/lib/time.c b/source3/lib/time.c
index 762c775ea2..e211bda3fb 100644
--- a/source3/lib/time.c
+++ b/source3/lib/time.c
@@ -1085,16 +1085,16 @@ time_t cli_make_unix_date3(struct cli_state *cli, void *date_ptr)
/* Large integer version. */
struct timespec nt_time_to_unix_timespec(NTTIME *nt)
{
- uint64 d;
+ int64 d;
struct timespec ret;
- if (*nt == 0 || *nt == (uint64)-1) {
+ if (*nt == 0 || *nt == (int64)-1) {
ret.tv_sec = 0;
ret.tv_nsec = 0;
return ret;
}
- d = *nt;
+ d = (int64)*nt;
/* d is now in 100ns units, since jan 1st 1601".
Save off the ns fraction. */
@@ -1106,20 +1106,20 @@ struct timespec nt_time_to_unix_timespec(NTTIME *nt)
/* Now adjust by 369 years to make the secs since 1970 */
d -= TIME_FIXUP_CONSTANT_INT;
- if (((time_t)d) <= TIME_T_MIN) {
+ if (d <= (int64)TIME_T_MIN) {
ret.tv_sec = TIME_T_MIN;
ret.tv_nsec = 0;
return ret;
}
- if (d >= (uint64)TIME_T_MAX) {
+ if (d >= (int64)TIME_T_MAX) {
ret.tv_sec = TIME_T_MAX;
ret.tv_nsec = 0;
return ret;
}
ret.tv_sec = (time_t)d;
- return ret;
+ return ret;
}
/****************************************************************************
Check if two NTTIMEs are the same.
@@ -1238,7 +1238,7 @@ void unix_timespec_to_nt_time(NTTIME *nt, struct timespec ts)
This is an absolute version of the one above.
By absolute I mean, it doesn't adjust from 1/1/1970 to 1/1/1601
- If the nttime_t was 5 seconds, the NTTIME is 5 seconds. JFM
+ If the time_t was 5 seconds, the NTTIME is 5 seconds. JFM
****************************************************************************/
void unix_to_nt_time_abs(NTTIME *nt, time_t t)