mirror of
https://git.proxmox.com/git/pve-common
synced 2025-07-27 13:44:54 +00:00
CLIFormatter - implement renderer for timestamps
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
This commit is contained in:
parent
57d4415163
commit
5e287f60ae
@ -3,6 +3,7 @@ package PVE::CLIFormatter;
|
||||
use strict;
|
||||
use warnings;
|
||||
use I18N::Langinfo;
|
||||
use POSIX qw(strftime);
|
||||
|
||||
use PVE::JSONSchema;
|
||||
use PVE::PTY;
|
||||
@ -10,6 +11,15 @@ use JSON;
|
||||
use utf8;
|
||||
use Encode;
|
||||
|
||||
sub render_timestamp {
|
||||
my ($epoch) = @_;
|
||||
|
||||
# ISO 8601 date format
|
||||
return strftime("%F %H:%M:%S", localtime($epoch));
|
||||
}
|
||||
|
||||
PVE::JSONSchema::register_renderer('timestamp', \&render_timestamp);
|
||||
|
||||
sub render_duration {
|
||||
my ($duration_in_seconds) = @_;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user