[pve-devel] r5499 - in pve-manager/pve2: lib/PVE/API2 www/manager

svn-commits at proxmox.com svn-commits at proxmox.com
Thu Feb 10 09:51:02 CET 2011


Author: dietmar
Date: 2011-02-10 09:51:02 +0100 (Thu, 10 Feb 2011)
New Revision: 5499

Modified:
   pve-manager/pve2/lib/PVE/API2/Nodes.pm
   pve-manager/pve2/www/manager/NodeConfig.js
Log:
display localized time


Modified: pve-manager/pve2/lib/PVE/API2/Nodes.pm
===================================================================
--- pve-manager/pve2/lib/PVE/API2/Nodes.pm	2011-02-09 12:46:41 UTC (rev 5498)
+++ pve-manager/pve2/lib/PVE/API2/Nodes.pm	2011-02-10 08:51:02 UTC (rev 5499)
@@ -2,7 +2,7 @@
 
 use strict;
 use warnings;
-
+use Time::Local qw(timegm_nocheck);
 use PVE::Tools;
 use PVE::SafeSyslog;
 use PVE::Cluster;
@@ -295,14 +295,22 @@
 		type => 'integer',
 		minimum => 1297163644,
 	    },
+	    localtime => {
+		description => "Seconds since 1970-01-01 00:00:00 (local time)",
+		type => 'integer',
+		minimum => 1297163644,
+	    },
         },
     },
     code => sub {
 	my ($param) = @_;
 
+	my $ctime = time();
+	my $ltime = timegm_nocheck(localtime($ctime));
 	my $res = {
 	    timezone => PVE::INotify::read_file('timezone'),
 	    time => time(),
+	    localtime => $ltime,
 	};
 
 	return $res;

Modified: pve-manager/pve2/www/manager/NodeConfig.js
===================================================================
--- pve-manager/pve2/www/manager/NodeConfig.js	2011-02-09 12:46:41 UTC (rev 5498)
+++ pve-manager/pve2/www/manager/NodeConfig.js	2011-02-10 08:51:02 UTC (rev 5499)
@@ -540,9 +540,9 @@
 	};
 
 	var rendertime = function(value) {
+	    var now = new Date();
 	    servertime = value * 1000;
-	    var now = new Date();
-	    starttime = now.getTime();
+	    starttime = now.getTime() - now.getTimezoneOffset()*60000;
 
 	    var html = Ext.DomHelper.markup({
 		id: myid,
@@ -558,7 +558,7 @@
 	    method: 'GET',
 	    rows: {
 		timezone: { header: 'Time zone' },
-		time: { header: 'Server time', renderer: rendertime }
+		localtime: { header: 'Server time', renderer: rendertime }
 	    }
 	});
 




More information about the pve-devel mailing list