summaryrefslogtreecommitdiff
path: root/Src/Modules/datetime.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/Modules/datetime.c')
-rw-r--r--Src/Modules/datetime.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/Src/Modules/datetime.c b/Src/Modules/datetime.c
index 00ebd2b49..63a04dc89 100644
--- a/Src/Modules/datetime.c
+++ b/Src/Modules/datetime.c
@@ -94,7 +94,7 @@ reverse_strftime(char *nam, char **argv, char *scalar, int quiet)
}
static int
-bin_strftime(char *nam, char **argv, Options ops, UNUSED(int func))
+output_strftime(char *nam, char **argv, Options ops, UNUSED(int func))
{
int bufsize, x;
char *endptr = NULL, *scalar = NULL, *buffer;
@@ -145,6 +145,25 @@ bin_strftime(char *nam, char **argv, Options ops, UNUSED(int func))
return 0;
}
+static int
+bin_strftime(char *nam, char **argv, Options ops, int func)
+{
+ int result = 1;
+ char *tz = getsparam("TZ");
+
+ startparamscope();
+ if (tz && *tz) {
+ Param pm = createparam("TZ", PM_LOCAL|PM_SCALAR|PM_EXPORTED);
+ if (pm)
+ pm->level = locallevel; /* because createparam() doesn't */
+ setsparam("TZ", ztrdup(tz));
+ }
+ result = output_strftime(nam, argv, ops, func);
+ endparamscope();
+
+ return result;
+}
+
static zlong
getcurrentsecs(UNUSED(Param pm))
{