Permalink
Browse files

handle daylight savings time

  • Loading branch information...
1 parent 7fa9682 commit 3a3460647e3859e41c006d759f5f27c8b748861e @dylang committed Nov 23, 2011
Showing with 11 additions and 1 deletion.
  1. +10 −0 lib/logging.js
  2. +1 −1 package.json
View
@@ -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
@@ -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>",

0 comments on commit 3a34606

Please sign in to comment.