objective c - Current time milliseconds returns minus value for 32 bit in iOS -


i need current time system in milliseconds. i'm using xcode 5.1.1 , tried following,

long timepassed_ms = ([[nsdate date] timeintervalsince1970] * 1000);

this working fine ipad retina(64-bit) emulator. when i'm running on ipad(32 bit) emulator, returns minus value.

output

in 32bit ipad : -2147483648

in 64bit ipad : 1408416635774(this correct time)

can this?

thanks in advance!

the interval values of long type is:

–2,147,483,648 2,147,483,647

try use long long instead, uses 8 bytes, , has interval:

–9,223,372,036,854,775,808 9,223,372,036,854,775,807

if getting wrong results using long long, try use double, make sure format result in case need place somewhere.


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -