[pve-devel] applied [pve-common] CLIFormatter - implement renderer for timestamps using GMT

Dietmar Maurer dietmar at proxmox.com
Thu Jul 5 08:52:35 CEST 2018


Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
---
 src/PVE/CLIFormatter.pm | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/PVE/CLIFormatter.pm b/src/PVE/CLIFormatter.pm
index 549ed31..052ed6d 100644
--- a/src/PVE/CLIFormatter.pm
+++ b/src/PVE/CLIFormatter.pm
@@ -20,6 +20,15 @@ sub render_timestamp {
 
 PVE::JSONSchema::register_renderer('timestamp', \&render_timestamp);
 
+sub render_timestamp_gmt {
+    my ($epoch) = @_;
+
+    # ISO 8601 date format, standard Greenwich time zone
+    return strftime("%F %H:%M:%S", gmtime($epoch));
+}
+
+PVE::JSONSchema::register_renderer('timestamp_gmt', \&render_timestamp_gmt);
+
 sub render_duration {
     my ($duration_in_seconds) = @_;
 
-- 
2.11.0




More information about the pve-devel mailing list