summaryrefslogtreecommitdiff
path: root/pp_sys.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2009-01-25 11:22:21 +0000
committerNicholas Clark <nick@ccl4.org>2009-01-25 11:22:21 +0000
commit5d09c1ed830e30fb5e2be5d5460523727ec7fa6e (patch)
tree5068535ab670af73fbbc3403df1de657079a9d55 /pp_sys.c
parentec47230bf76c36a159bca22355ab273a83ee25ce (diff)
downloadperl-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.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/pp_sys.c b/pp_sys.c
index 225b55ef79..cfbf9182ea 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -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 */