Sha256: eb196b798415335c703a040ee77ce12f8c93e12a33878fd4f218b04c681c71b6

Contents?: true

Size: 446 Bytes

Versions: 4

Compression:

Stored size: 446 Bytes

Contents

window.Time =
  # getTimezoneOffset() returns local offset in hours
  tz_offset: 60 * -( new Date() ).getTimezoneOffset()
  
  local_to_utc: (timestamp) ->
    parseInt(timestamp, 10) - Time.tz_offset
  
  utc_to_local: (timestamp) ->
    parseInt(timestamp, 10) + Time.tz_offset
  
  server_to_client: (timestamp) ->
    @utc_to_local(timestamp) * 1000
  
  client_to_server: (timestamp) ->
    Math.floor( @local_to_utc(timestamp / 1000) )
  

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rrd-grapher-1.0.3 lib/rrd-grapher/assets/javascripts/classes/time.coffee
rrd-grapher-1.0.2 lib/rrd-grapher/assets/javascripts/classes/time.coffee
rrd-grapher-1.0.1 lib/rrd-grapher/assets/javascripts/classes/time.coffee
rrd-grapher-1.0.0 lib/rrd-grapher/assets/javascripts/classes/time.coffee