summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2012-01-18 14:36:12 +1100
committerTony Cook <tony@develop-help.com>2012-01-18 14:40:47 +1100
commite2054bceda6db6aa9644dfd39b55e7f06bcbbdce (patch)
tree43869edad1fa32665b7e0ab5fb8edba0a655f67b /ext
parent33f89799d9328f3d175aa913900d16794119e284 (diff)
downloadperl-e2054bceda6db6aa9644dfd39b55e7f06bcbbdce.tar.gz
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.
Diffstat (limited to 'ext')
-rw-r--r--ext/POSIX/POSIX.xs4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs
index f9a91ca8b2..3e23433c13 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);