View Issue Details

IDProjectCategoryView StatusLast Update
0008684Multi Theft Auto : San AndreasGeneralpublic2015-01-01 03:52
ReporterFecheAssigned Toccw 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformPCOSWindowsOS Version7
Product Version 
Target VersionFixed in Version1.4.1 
Summary0008684: getRealTime() with timestamp argument passing wrong date
Description

So I found out that this is actually a bug, if you set a timestamp on getRealTime() it will return a wrong date. Happens both server & client.

Steps To Reproduce

local stmp = getRealTime(1419087013)
outputChatBox(stmp.hour.. ":" ..stmp.minute)

Returns 11:50, should be 14:50..

TagsNo tags attached.

Activities

arranTuna

2014-12-20 16:43

manager   ~~0022703

local stmp = getRealTime(getRealTime().timestamp)
outputChatBox(stmp.hour.. ":" ..stmp.minute)

Returns the correct value for me client and server side, you do realise that it takes into account the timezone of the system which is why the time stamp returns different times?

Feche

2014-12-20 19:25

viewer   ~~0022704

Correct me if I'm wrong, but timestamp is basically the amount of seconds passed since 1970, so if I put 1419087013 seconds on my PC it should return the same date on my PC or any other PC's without taking account of my timezone.

arranTuna

2014-12-20 20:28

manager   ~~0022708

Yes but the Unix timestamp uses UTC 0. If you're not in UTC 0 then getRealTime adjusts to your local time.

sbx320

2014-12-23 10:27

administrator   ~~0022717

r6976 allows you to specify if you want localtime or UTC+0.

https://code.google.com/p/mtasa-blue/source/detail?r=6976

Feche

2015-01-01 03:52

viewer   ~~0022765

Thank you!

Issue History

Date Modified Username Field Change