objective c - NSDate timeIntervalSinceNow and local timezone? -
i'm doing calculation find nstimeinterval
between known futuredate
(which in gmt/utc) , current time (and timezone) device resides.
nstimeinterval approachinterval = [futuredate timeintervalsincenow];
i know nsdate
not store timezone specific data, rather being calculated when date needs displaying on device.
my question initial tests (i'm in gmt+0001) seems nstimeinterval
returned not account local timezone. have manually calculate timezone offset , remove interval, , best way of doing given can't supply nsdate
correct timezone (using timeintervalsincedate:
example)
nsdate
represents single point in time. not have (and not need!!) time zone. "a known futuredate (which in gmt/utc)" or "i can't supply nsdate correct timezone" not make sense.
[futuredate timeintervalsincenow]
returns time interval between futuredate
, current date , time , independent of time zones.
if not expected result, perhaps calculation of futuredate
wrong.
Comments
Post a Comment