diff options
author | Craig A. Berry <craigberry@mac.com> | 2009-04-25 17:51:38 -0500 |
---|---|---|
committer | Craig A. Berry <craigberry@mac.com> | 2009-04-25 18:11:55 -0500 |
commit | d95a2ea538e6c332f36c34ca45b78d6ad93c3a1f (patch) | |
tree | 7af896a0f675ba7495ed49cb5f70ad4a26e60d65 /pp_sys.c | |
parent | 4efe685a06ca02d3bdef0d82787eb46835ec9e7e (diff) | |
download | perl-d95a2ea538e6c332f36c34ca45b78d6ad93c3a1f.tar.gz |
Make time64 use NV for time_t, I32 for year, not Quad_t.
This means it should run on anything that does not have a 64-bit
integer type available but does have a double. Presumably this
includes platforms that define PERL_MICRO, so we now use the
same extended time implementation for everything that runs Perl.
Diffstat (limited to 'pp_sys.c')
-rw-r--r-- | pp_sys.c | 31 |
1 files changed, 2 insertions, 29 deletions
@@ -29,10 +29,8 @@ #include "EXTERN.h" #define PERL_IN_PP_SYS_C #include "perl.h" -#if !defined(PERL_MICRO) && defined(Quad_t) -# include "time64.h" -# include "time64.c" -#endif +#include "time64.h" +#include "time64.c" #ifdef I_SHADOW /* Shadow password support for solaris - pdo@cs.umd.edu @@ -4469,15 +4467,9 @@ PP(pp_gmtime) { dVAR; dSP; -#if defined(PERL_MICRO) || !defined(Quad_t) - Time_t when; - const struct tm *err; - struct tm tmbuf; -#else Time64_T when; struct TM tmbuf; struct TM *err; -#endif const char *opname = PL_op->op_type == OP_LOCALTIME ? "localtime" : "gmtime"; static const char * const dayname[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; @@ -4485,30 +4477,12 @@ PP(pp_gmtime) {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; -#if defined(PERL_MICRO) || !defined(Quad_t) - if (MAXARG < 1) - (void)time(&when); - else - when = (Time_t)SvIVx(POPs); - - if (PL_op->op_type == OP_LOCALTIME) - err = localtime(&when); - else - err = gmtime(&when); - - if (!err) - tmbuf = *err; -#else if (MAXARG < 1) { time_t now; (void)time(&now); when = (Time64_T)now; } else { - /* XXX POPq uses an SvIV so it won't work with 32 bit integer scalars - using a double causes an unfortunate loss of accuracy on high numbers. - What we really need is an SvQV. - */ double input = Perl_floor(POPn); when = (Time64_T)input; if (when != input && ckWARN(WARN_OVERFLOW)) { @@ -4521,7 +4495,6 @@ PP(pp_gmtime) err = S_localtime64_r(&when, &tmbuf); else err = S_gmtime64_r(&when, &tmbuf); -#endif if (err == NULL && ckWARN(WARN_OVERFLOW)) { /* XXX %lld broken for quads */ |