From e2054bceda6db6aa9644dfd39b55e7f06bcbbdce Mon Sep 17 00:00:00 2001 From: Tony Cook Date: Wed, 18 Jan 2012 14:36:12 +1100 Subject: [PATCH] avoid truncating time values when long is smaller than time_t long is only 32-bits on x64 Win32, but time_t is 64-bits. This was warning: POSIX.xs(1777) : warning C4244: 'initializing' : conversion from 'time_t' to 'const long', possible loss of data The check against (time_t)-1 is the approved check from ANSI C 89 and 99. --- ext/POSIX/POSIX.xs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs index f9a91ca..3e23433 100644 --- a/ext/POSIX/POSIX.xs +++ b/ext/POSIX/POSIX.xs @@ -1774,8 +1774,8 @@ asctime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = -1) mytm.tm_yday = yday; mytm.tm_isdst = isdst; if (ix) { - const long result = mktime(&mytm); - if (result == -1) + const time_t result = mktime(&mytm); + if (result == (time_t)-1) SvOK_off(TARG); else if (result == 0) sv_setpvn(TARG, "0 but true", 10); -- 2.7.4