Ticket Created
over 5 years ago

WERETECH-8841 (for Time.Moment/Duration constructor not being type safe)

Moment Seconds limited to Number / Signed 32bit Integer

Am I right in thinking there is an issue with the Garmin O/S when we reach the rollover of seconds within a signed 32bit int.  This is happening with seconds greater than 2147483647 at Tue, 19 Jan 2038 03:14:07 GMT.

Or is there a recommended workaround either external or within the system.

I discovered issues today while testing some solar calculation code today with dates beyond the above.

  • In CIQ, it's limited to 32 bits (a Number).  
  • Hmm on further investigation it looks like Moments do use longs internally to store seconds.  The root cause of my problem was I was creating the test moment with the code similar to below: moment = new Time.Moment( 2534846400 ); //29/04/2050 12:00:00 The compiler was taking 2534846400 and converting it to a negatively signed integer before passing it in. When I forced the number to be taken as a long with code below:- moment = new Time.Moment( 2534846400l ); The moment created works correctly. However when I call the following on the moment      Time.Gregorian.info(moment) The results for year, day, etc are all wrong and look to be limited to 2147483647 seconds =   19.01.2038 03:14:08 
  • Thanks, used my own cludge for the moment var momentd = moment.value().toDouble(); if (momentd
  • This has been known for a long time - I'm sure Garim will do sothing about it at some time, but I doubt it will be very soon.