From 9a6bac75b80ecc93103a38f66204fb98d266c540 Mon Sep 17 00:00:00 2001
From: miker <miker@9efc2488-bf62-4759-914b-345cdb29e865>
Date: Mon, 6 Mar 2006 05:48:44 +0000
Subject: [PATCH] adding an ISO timestamp builder

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@660 9efc2488-bf62-4759-914b-345cdb29e865
---
 src/perlmods/OpenSRF/Utils.pm | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/perlmods/OpenSRF/Utils.pm b/src/perlmods/OpenSRF/Utils.pm
index a84d130..55092e7 100644
--- a/src/perlmods/OpenSRF/Utils.pm
+++ b/src/perlmods/OpenSRF/Utils.pm
@@ -36,7 +36,7 @@ use Exporter;
 %EXPORT_TAGS = (
 	common		=> [qw(interval_to_seconds seconds_to_interval sendmail)],
 	daemon		=> [qw(safe_fork set_psname daemonize)],
-	datetime	=> [qw(clense_ISO8601 interval_to_seconds seconds_to_interval)],
+	datetime	=> [qw(clense_ISO8601 gmtime_ISO8601 interval_to_seconds seconds_to_interval)],
 );
 
 Exporter::export_ok_tags('common','daemon','datetime');  # add aa, cc and dd to @EXPORT_OK
@@ -338,6 +338,20 @@ sub set_psname {
 	$0 = $PS_NAME if ($PS_NAME);
 }
 
+sub gmtime_ISO8601 {
+	my $self = shift;
+	my @date = gmtime;
+
+	my $y = $date[5] + 1900;
+	my $M = $date[4] + 1;
+	my $d = $date[3];
+	my $h = $date[2];
+	my $m = $date[1];
+	my $s = $date[0];
+
+	return sprintf('%d-%0.2d-%0.2dT%0.2d:%0.2d:%0.2d+00:00', $y, $M, $d, $h, $m, $s);
+}
+
 sub clense_ISO8601 {
 	my $self = shift;
 	my $date = shift || $self;
-- 
2.11.0