Skip to content

default timezones set on datetime #63

@ralmgren1

Description

@ralmgren1

I would like to propose modifying src/common.c to remove line 380 in function from_datetime_kobject()

settimezone(result,"GMT");

and also removing or commenting the entire function settimezone() at lines 66-74 since that is the only place this function is used. Here is the reason:
This function returns an R POSIXct object. In R, such an object is always in UTC. It may optionally include a tzone attribute, indicating how it would prefer to be displayed; without that attribute it is displayed by default in the machine local timezone though any different display timezone can also be specified. Kdb+ datetime objects have no such property, so the interface should not add this information. If the Kdb+ datetime is not UTC, then the conversion will simply be incorrect, and adding the label does not fix it.
R Sys.time() returns local time with no default time zone. It would be useful if execute(db,'.z.z') also had no default time zone. At least in older versions of R, warnings were produced if arithmetic were done between POSIXct objects with different default time zones.
Finally, "GMT" is an obsolete specification; the modern usage is "UTC".
To summarize: attaching a default time zone to POSIXct objects returned by rkdb is unnecessary, is an inaccurate reflection of what is in the underlying data table, and is a potential source of confusing errors. It would be simpler to remove that code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions