Skip to content

Date Encoding Issue #3

@TropicalPenguin

Description

@TropicalPenguin

The pyorient unit test test_binary_date (tests.test_serializations.SerializationTestCase) is failing. The returned date for me is a day off.

I narrowed this down to the mktime/gmtime pair in encoding/decoding. mktime expects a local time and gmtime() a UTC time.

Supposedly it's not portable, but I wrote a little test program, and adding this to the structure passed to mktime seems to work better:

t.tm_isdst = -1;
time_t now = time(0);
t.tm_sec += difftime(now, 0) - difftime(mktime(gmtime(&now)), 0);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions