From b371cbb6897ef66b22455c0b3682d50c91f990b2 Mon Sep 17 00:00:00 2001 From: Gerhard Gonter <ggonter@gmail.com> Date: Sun, 17 Oct 2021 15:02:22 +0200 Subject: [PATCH] added more timestamp functions --- modules/util/Util/ts.pm | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/modules/util/Util/ts.pm b/modules/util/Util/ts.pm index cce3c5c..8b5e516 100644 --- a/modules/util/Util/ts.pm +++ b/modules/util/Util/ts.pm @@ -8,7 +8,7 @@ use vars qw(@ISA @EXPORT); require Exporter; @ISA= qw(Exporter); -@EXPORT= qw(ts ts_date ts_ISO ts_ISO2_gmt ts_pg); +@EXPORT= qw(ts ts_date ts_ISO ts_ISO_gmt ts_ISO2_gmt ts_pg); sub ts { @@ -25,6 +25,13 @@ sub ts_date sprintf ("%4d-%02d-%02d", $ts[5]+1900, $ts[4]+1, $ts[3]); } +sub ts_gmdate +{ + my $time= shift || time (); + my @ts= gmtime ($time); + sprintf ("%4d-%02d-%02d", $ts[5]+1900, $ts[4]+1, $ts[3]); +} + sub ts_ISO { my $time= shift || time (); @@ -41,6 +48,14 @@ sub ts_ISO2_gmt $ts[5]+1900, $ts[4]+1, $ts[3], $ts[2], $ts[1], $ts[0]); } +sub ts_ISO3_gmt +{ + my $time= shift || time (); + my @ts= gmtime ($time); + sprintf ("%04d-%02d-%02dT%02d:%02d:%02dZ", + $ts[5]+1900, $ts[4]+1, $ts[3], $ts[2], $ts[1], $ts[0]); +} + sub ts_ISO_gmt { my $time= shift || time (); -- GitLab