Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

handle daylight savings time

  • Loading branch information...
commit 3a3460647e3859e41c006d759f5f27c8b748861e 1 parent 7fa9682
@dylang authored
Showing with 11 additions and 1 deletion.
  1. +10 −0 lib/logging.js
  2. +1 −1  package.json
View
10 lib/logging.js
@@ -9,6 +9,16 @@ var clusterCPU = 'CLUSTER_WORKER' in process.env ? Style(Style.GREEN, process.en
var TIMEZONE_OFFSET = (240 - (new Date).getTimezoneOffset()) * 60000;
+
+function stdTimezoneOffset() {
+ var fullYear = (new Date()).getFullYear();
+ var jan = new Date(fullYear, 0, 1);
+ var jul = new Date(fullYear, 6, 1);
+ return Math.max(jan.getTimezoneOffset(), jul.getTimezoneOffset()) * 60000;
+}
+
+TIMEZONE_OFFSET = TIMEZONE_OFFSET < stdTimezoneOffset() ? TIMEZONE_OFFSET + 3600000 : TIMEZONE_OFFSET;
+
function writeLog(d) {
var res = process.stdout.write(d + '\n');
View
2  package.json
@@ -1,6 +1,6 @@
{
"name": "logging",
- "version": "2.0.12",
+ "version": "2.0.13",
"description": "Super sexy color console logging with cluster support.",
"homepage": "http://github.com/dylang/logging",
"author": "Dylan Greene <dylang@gmail.com>",
Please sign in to comment.
Something went wrong with that request. Please try again.