Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isc_decode_timestamp() unconditionally sets tm_isdst to 0 in the output struct tm [CORE3877] #4214

Open
firebird-automations opened this issue Jun 25, 2012 · 0 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Vadim Zeitlin (vz)

The function TimeStamp::decode() used by public isc_decode_timestamp() functions always returns struct tm with its tm_isdst field set to 0 due to a memset() of the whole struct to 0 that is done in the beginning of TimeStamp::decode_date() called by it.

I believe this is wrong as it means that passing the result of localtime() to isc_encode_timestamp() and then using mktime() with the result of isc_decode_timestamp() gives a different value from the one you started with when the DST is in effect.

Ideal would probably be to correctly determine whether the DST is in effect or not but as a minimal fix just setting tm_isdst to -1 in TimeStamp::decode() would be good enough.

Notice that while I encountered this problem with 2.1.4, the code in the latest svn didn't change except that it's now in a different file, see http://firebird.svn.sourceforge.net/viewvc/firebird/firebird/trunk/src/common/classes/NoThrowTimeStamp.cpp?view=markup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant