summaryrefslogtreecommitdiffstats
path: root/lib/time.sh
diff options
context:
space:
mode:
Diffstat (limited to 'lib/time.sh')
-rw-r--r--lib/time.sh35
1 files changed, 22 insertions, 13 deletions
diff --git a/lib/time.sh b/lib/time.sh
index 21e7448..95510e5 100644
--- a/lib/time.sh
+++ b/lib/time.sh
@@ -139,18 +139,7 @@ ob_rfc822_mktime()
return 0
}
-## @brief Convert seconds since the Epoch into a date and time
-## @details \fBob_iso8601_gmtime\fP() converts the number of non-leap seconds
-## elapsed since the Epoch into date and time in UTC formatted
-## according to ISO 8601. It is similar to the C function \fBgmtime\fP
-## except that it returns a formatted string instead of a structure.
-## It is intended to generate a date and time usable with a
-## POSIX-conformant \fBtouch\fP utility.
-## @operand timep req The number of non-leap seconds elapsed since the Epoch.
-## @return Returns 0.
-## @stdout Prints the date and time in UTC formatted according to ISO 8601.
-## @pure yes This function has no side effects.
-ob_iso8601_gmtime()
+_ob_gmtime()
{
local timep="${1}"
shift 1 || _ob_abort
@@ -177,7 +166,27 @@ ob_iso8601_gmtime()
done
mday=$((${timep} - $(_ob_month_to_days ${mon} ${year}) + 1))
- printf '%04d-%02d-%02dT%02d:%02d:%02dZ' \
+ printf '%04d %02d %02d %02d %02d %02d' \
${year} ${mon} ${mday} ${hour} ${min} ${sec}
return 0
}
+
+## @brief Convert seconds since the Epoch into a date and time
+## @details \fBob_iso8601_gmtime\fP() converts the number of non-leap seconds
+## elapsed since the Epoch into date and time in UTC formatted
+## according to ISO 8601. It is similar to the C function \fBgmtime\fP
+## except that it returns a formatted string instead of a structure.
+## It is intended to generate a date and time usable with a
+## POSIX-conformant \fBtouch\fP utility.
+## @operand timep req The number of non-leap seconds elapsed since the Epoch.
+## @return Returns 0.
+## @stdout Prints the date and time in UTC formatted according to ISO 8601.
+## @pure yes This function has no side effects.
+ob_iso8601_gmtime()
+{
+ local timep="${1}"
+ shift 1 || _ob_abort
+
+ printf '%04d-%02d-%02dT%02d:%02d:%02dZ' $(_ob_gmtime "${timep}")
+ return 0
+}