Skip to content
This repository has been archived by the owner on Jan 10, 2019. It is now read-only.

Commit

Permalink
update atb calc
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Stoner authored and Brian Stoner committed Sep 22, 2016
1 parent 3c0133a commit 43538ec
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,18 @@ exports.main = function(options, callbacks) {
if (ss.storage.atb == undefined) {
var oneWeek = 604800000,
oneDay = 86400000,
timeSinceEpoch = new Date().getTime() - 1456333200000,
oneHour = 3600000,
oneMinute = 60000,
estEpoch = 1456290000000,
localDate = new Date(),
localTime = localDate.getTime(),
utcTime = localTime + (localDate.getTimezoneOffset() * oneMinute),
est = new Date(utcTime + (oneHour * -5)),
dstStartDay = 13 - ((est.getFullYear() - 2016) % 6),
dstStopDay = 6 - ((est.getFullYear() - 2016) % 6),
isDST = (est.getMonth() > 2 || (est.getMonth() == 2 && est.getDate() >= dstStartDay)) && (est.getMonth() < 10 || (est.getMonth() == 10 && est.getDate() < dstStopDay)),
epoch = isDST ? estEpoch - oneHour : estEpoch,
timeSinceEpoch = new Date().getTime() - epoch,
majorVersion = Math.ceil(timeSinceEpoch / oneWeek),
minorVersion = Math.ceil(timeSinceEpoch % oneWeek / oneDay);

Expand Down

0 comments on commit 43538ec

Please sign in to comment.