summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Manuel <nilslice@gmail.com>2017-04-03 12:04:34 -0700
committerSteve Manuel <nilslice@gmail.com>2017-04-03 12:04:34 -0700
commite7f4347a81acd1e757739838c3dcd9660f655a35 (patch)
tree76a98dbf4d173e4b61571f5d1fb0d89116045728
parent249fb1d41721a6fb25057f977a0a27daf773c936 (diff)
set date to UTC times on server create, and updated editor timestamp to increase precision to seconds level
-rw-r--r--management/manager/manager.go5
-rw-r--r--system/admin/handlers.go2
2 files changed, 5 insertions, 2 deletions
diff --git a/management/manager/manager.go b/management/manager/manager.go
index 7dd2a58..93c3315 100644
--- a/management/manager/manager.go
+++ b/management/manager/manager.go
@@ -39,7 +39,10 @@ const managerHTML = `
hour = hour + 12;
}
- var date = new Date(year, month, day, hour, minute);
+ // add seconds to Date() to differentiate times more precisely,
+ // although not 100% accurately
+ var sec = (new Date()).getSeconds();
+ var date = new Date(year, month, day, hour, minute, sec);
$ts.val(date.getTime());
}
diff --git a/system/admin/handlers.go b/system/admin/handlers.go
index a585faa..d04adec 100644
--- a/system/admin/handlers.go
+++ b/system/admin/handlers.go
@@ -1531,7 +1531,7 @@ func editHandler(res http.ResponseWriter, req *http.Request) {
// create a timestamp if one was not set
if ts == "" {
- ts = fmt.Sprintf("%d", int64(time.Nanosecond)*time.Now().UnixNano()/int64(time.Millisecond))
+ ts = fmt.Sprintf("%d", int64(time.Nanosecond)*time.Now().UTC().UnixNano()/int64(time.Millisecond))
req.PostForm.Set("timestamp", ts)
}