If I set the clock using JulianDate the resulting view will be wrong by my local time offset (PST = UTC-0800).
e.g.,
viewer.clock.currentTime = new Cesium.JulianDate(jDay, jSec); // gives the wrong view
viewer.clock.currentTime = new Cesium.JulianDate(jDay, jSec - 8 * 3600); // gives the right view
By wrong I mean that the sun location/terrain lighting is wrong by the UTC offset…
Any help?
Thanks, Matt.
Where are you getting jDay and jSec from? JulianDate always uses the UTC time zone.
I’m starting with a unix timestamp and calculating jDay and jSec (php unixtojd()).
The conversion is correct:
unixSec = 1437497376 gives:
jDay = 2457225
jSec = 60576
But if I use these values the resulting view is off by +8 hours.
Looks like you’re not accounting for the fact that Julian days start at noon, not midnight.
your unix timestamp corresponds to: 2015-07-21T16:49:36+00:00
converting to JD with http://aa.usno.navy.mil/data/docs/JulianDate.php produces: 2457225.201111
separating into day number and seconds of day for the constructor produces: 2457225, 17376
feeding that into the JulianDate constructor returns: 2015-07-21T16:49:36Z
your value for jSec is off by 43200 which is 12 hours.
You’re right. That fixes it. Thank you very much. - Matt