diff options
author | Nicholas Clark <nick@ccl4.org> | 2009-01-25 11:22:21 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2009-01-25 11:22:21 +0000 |
commit | 5d09c1ed830e30fb5e2be5d5460523727ec7fa6e (patch) | |
tree | 5068535ab670af73fbbc3403df1de657079a9d55 /pp_sys.c | |
parent | ec47230bf76c36a159bca22355ab273a83ee25ce (diff) | |
download | perl-5d09c1ed830e30fb5e2be5d5460523727ec7fa6e.tar.gz |
microperl has no idea about 64 bit types, so don't use the y2038 code for it.
Diffstat (limited to 'pp_sys.c')
-rw-r--r-- | pp_sys.c | 27 |
1 files changed, 25 insertions, 2 deletions
@@ -29,8 +29,10 @@ #include "EXTERN.h" #define PERL_IN_PP_SYS_C #include "perl.h" -#include "time64.h" -#include "time64.c" +#ifndef PERL_MICRO +# include "time64.h" +# include "time64.c" +#endif #ifdef I_SHADOW /* Shadow password support for solaris - pdo@cs.umd.edu @@ -4422,9 +4424,15 @@ PP(pp_gmtime) { dVAR; dSP; +#ifdef PERL_MICRO + 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"}; @@ -4432,6 +4440,20 @@ PP(pp_gmtime) {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; +#ifdef PERL_MICRO + 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); @@ -4454,6 +4476,7 @@ PP(pp_gmtime) err = localtime64_r(&when, &tmbuf); else err = gmtime64_r(&when, &tmbuf); +#endif if( err == NULL ) { /* XXX %lld broken for quads */ |