Skip to content

bugfix: unequal timezone after decoding #217

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

Merged
merged 1 commit into from
Oct 4, 2022

Conversation

oleg-jukovec
Copy link
Collaborator

@oleg-jukovec oleg-jukovec commented Sep 15, 2022

The patch fixes unequal timezones after Datetime encoding/decoding. It does two things for the fix:

  1. After the patch, a location name is picked from Time.Location().String() instead of Time.Zone(). It allows us to encode a timezone from the original name.
  2. A decoder function tries to load a location from system location. It allows to handle unfixed timezones properly.

I didn't forget about (remove if it is not applicable):

@oleg-jukovec oleg-jukovec force-pushed the oleg-jukovec/datetime-non-fixed branch from e99fa4b to 5617d88 Compare September 15, 2022 16:07
@oleg-jukovec oleg-jukovec marked this pull request as ready for review September 15, 2022 16:20
@oleg-jukovec oleg-jukovec force-pushed the oleg-jukovec/datetime-non-fixed branch from 5617d88 to fa0ec5b Compare September 16, 2022 10:54
@oleg-jukovec oleg-jukovec force-pushed the oleg-jukovec/datetime-non-fixed branch from fa0ec5b to dee71a1 Compare September 21, 2022 08:43
oleg-jukovec added a commit that referenced this pull request Sep 21, 2022
The patch fixes unequal timezones after Datetime encoding/decoding.
It does two things for the fix:

1. After the patch, a location name is picked from
Time.Location().String() instead of Time.Zone(). It allows us to
encode a timezone from the original name.
2. A decoder function tries to load a location from system location.
It allows to handle unfixed timezones properly.

Closes #217
@oleg-jukovec oleg-jukovec force-pushed the oleg-jukovec/datetime-non-fixed branch from dee71a1 to e5c2604 Compare September 21, 2022 15:55
oleg-jukovec added a commit that referenced this pull request Sep 21, 2022
The patch fixes unequal timezones after Datetime encoding/decoding.
It does two things for the fix:

1. After the patch, a location name is picked from
Time.Location().String() instead of Time.Zone(). It allows us to
encode a timezone from the original name.
2. A decoder function tries to load a location from system location.
It allows to handle unfixed timezones properly.

Closes #217
@oleg-jukovec oleg-jukovec force-pushed the oleg-jukovec/datetime-non-fixed branch from e5c2604 to 4c392a2 Compare September 21, 2022 15:57
@oleg-jukovec oleg-jukovec changed the title datetime: always return time with fixed zone bugfix: unequal timezone after decoding Sep 21, 2022
oleg-jukovec added a commit that referenced this pull request Sep 21, 2022
The patch fixes unequal timezones after Datetime encoding/decoding.
It does two things for the fix:

1. After the patch, a location name is picked from
Time.Location().String() instead of Time.Zone(). It allows us to
encode a timezone from the original name.
2. A decoder function tries to load a location from system location.
It allows to handle unfixed timezones properly.

Closes #217
@oleg-jukovec oleg-jukovec force-pushed the oleg-jukovec/datetime-non-fixed branch from 4c392a2 to fbf09db Compare September 21, 2022 15:58
@oleg-jukovec
Copy link
Collaborator Author

oleg-jukovec commented Sep 21, 2022

After additional experiments and research, I decided to go the opposite way: pick up an original name of a timezone from Time.Location().String() in encoding + try to create DST timezones in decoding if possible instead of fixed timezones usage.

The main drawbacks of this approach are that "Local" location is not supported. But it looks logical from a one point of view. In any case, it looks simpler than the previous logic.

oleg-jukovec added a commit that referenced this pull request Sep 22, 2022
The patch fixes unequal timezones after Datetime encoding/decoding.
It does two things for the fix:

1. After the patch, a location name is picked from
Time.Location().String() instead of Time.Zone(). It allows us to
encode a timezone from the original name.
2. A decoder function tries to load a location from system location.
It allows to handle unfixed timezones properly.

Closes #217
@oleg-jukovec oleg-jukovec force-pushed the oleg-jukovec/datetime-non-fixed branch from fbf09db to b583c23 Compare September 22, 2022 07:10
@DifferentialOrange
Copy link
Member

The main drawbacks of this approach are that "Local" location is not supported.

So you didn't found a way to parse Local except for messing with system files?

oleg-jukovec added a commit that referenced this pull request Sep 22, 2022
The patch fixes unequal timezones after Datetime encoding/decoding.
It does two things for the fix:

1. After the patch, a location name is picked from
Time.Location().String() instead of Time.Zone(). It allows us to
encode a timezone from the original name.
2. A decoder function tries to load a location from system location.
It allows to handle unfixed timezones properly.

Closes #217
@oleg-jukovec oleg-jukovec force-pushed the oleg-jukovec/datetime-non-fixed branch from b583c23 to ac5c725 Compare September 22, 2022 08:37
oleg-jukovec added a commit that referenced this pull request Sep 22, 2022
The patch fixes unequal timezones after Datetime encoding/decoding.
It does two things for the fix:

1. After the patch, a location name is picked from
Time.Location().String() instead of Time.Zone(). It allows us to
encode a timezone from the original name.
2. A decoder function tries to load a location from system location.
It allows to handle unfixed timezones properly.

Closes #217
@oleg-jukovec oleg-jukovec force-pushed the oleg-jukovec/datetime-non-fixed branch from ac5c725 to 86390b6 Compare September 22, 2022 09:01
oleg-jukovec added a commit that referenced this pull request Sep 22, 2022
The patch fixes unequal timezones after Datetime encoding/decoding.
It does two things for the fix:

1. After the patch, a location name is picked from
Time.Location().String() instead of Time.Zone(). It allows us to
encode a timezone from the original name.
2. A decoder function tries to load a location from system location.
It allows to handle unfixed timezones properly.

Closes #217
@oleg-jukovec oleg-jukovec force-pushed the oleg-jukovec/datetime-non-fixed branch from 86390b6 to 59cf935 Compare September 22, 2022 11:22
oleg-jukovec added a commit that referenced this pull request Sep 22, 2022
The patch fixes unequal timezones after Datetime encoding/decoding.
It does two things for the fix:

1. After the patch, a location name is picked from
Time.Location().String() instead of Time.Zone(). It allows us to
encode a timezone from the original name.
2. A decoder function tries to load a location from system location.
It allows to handle unfixed timezones properly.

Closes #217
@oleg-jukovec oleg-jukovec force-pushed the oleg-jukovec/datetime-non-fixed branch from 59cf935 to 7099bee Compare September 22, 2022 11:27
Copy link
Member

@DifferentialOrange DifferentialOrange left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I remember, the only question left unanswered is Local parsing. If you (or @LeonidVas) find the solution, I'll get back and review the updates. If you decide to leave it as is, let it be (I think we'll wait for @LeonidVas on this question too).

@oleg-jukovec oleg-jukovec requested review from vr009 and LeonidVas and removed request for vr009 September 23, 2022 10:34
The patch fixes unequal timezones after Datetime encoding/decoding.
It does two things for the fix:

1. After the patch, a location name is picked from
Time.Location().String() instead of Time.Zone(). It allows us to
encode a timezone from the original name.
2. A decoder function tries to load a location from system location.
It allows to handle unfixed timezones properly.

Closes #217
@oleg-jukovec oleg-jukovec force-pushed the oleg-jukovec/datetime-non-fixed branch from 7099bee to 29cd8d5 Compare October 4, 2022 07:18
@oleg-jukovec oleg-jukovec merged commit 64e41c5 into master Oct 4, 2022
@oleg-jukovec oleg-jukovec deleted the oleg-jukovec/datetime-non-fixed branch October 4, 2022 11:04
oleg-jukovec added a commit that referenced this pull request Oct 4, 2022
Overview

    The release adds support for the latest version of the
    queue package with master-replica switching.

Breaking changes

    There are no breaking changes in the release.

New features

    Support the queue 1.2.1 (#177).

    ConnectionHandler interface for handling changes of connections in
    ConnectionPool (#178)

    Execute, ExecuteTyped and ExecuteAsync methods to
    ConnectionPool (#176)

    ConnectorAdapter type to use ConnectionPool as Connector
    interface (#176)

    An example how to use queue and connection_pool subpackages
    together (#176)

Bugfixes

    Mode type description in the connection_pool subpackage (#208)

    Missed Role type constants in the connection_pool subpackage (#208)

    ConnectionPool does not close UnknownRole connections (#208)

    Segmentation faults in ConnectionPool requests after
    disconnect (#208)

    Addresses in ConnectionPool may be changed from an external
    code (#208)

    ConnectionPool recreates connections too often (#208)

    A connection is still opened after ConnectionPool.Close() (#208)

    Future.GetTyped() after Future.Get() does not decode response
    correctly (#213)

    Decimal package use a test function GetNumberLength instead of a
    package-level function getNumberLength (#219)

    Datetime location after encode + decode is unequal (#217)
oleg-jukovec added a commit that referenced this pull request Oct 4, 2022
Overview

    The release adds support for the latest version of the
    queue package with master-replica switching.

Breaking changes

    There are no breaking changes in the release.

New features

    Support the queue 1.2.1 (#177).

    ConnectionHandler interface for handling changes of connections in
    ConnectionPool (#178).

    Execute, ExecuteTyped and ExecuteAsync methods to
    ConnectionPool (#176).

    ConnectorAdapter type to use ConnectionPool as Connector
    interface (#176).

    An example how to use queue and connection_pool subpackages
    together (#176).

Bugfixes

    Mode type description in the connection_pool subpackage (#208).

    Missed Role type constants in the connection_pool
    subpackage (#208).

    ConnectionPool does not close UnknownRole connections (#208).

    Segmentation faults in ConnectionPool requests after
    disconnect (#208).

    Addresses in ConnectionPool may be changed from an external
    code (#208).

    ConnectionPool recreates connections too often (#208).

    A connection is still opened after ConnectionPool.Close() (#208).

    Future.GetTyped() after Future.Get() does not decode response
    correctly (#213).

    Decimal package use a test function GetNumberLength instead of a
    package-level function getNumberLength (#219).

    Datetime location after encode + decode is unequal (#217).
@oleg-jukovec oleg-jukovec mentioned this pull request Oct 4, 2022
oleg-jukovec added a commit that referenced this pull request Oct 5, 2022
Overview

    The release adds support for the latest version of the
    queue package with master-replica switching.

Breaking changes

    There are no breaking changes in the release.

New features

    Support the queue 1.2.1 (#177).

    ConnectionHandler interface for handling changes of connections in
    ConnectionPool (#178).

    Execute, ExecuteTyped and ExecuteAsync methods to
    ConnectionPool (#176).

    ConnectorAdapter type to use ConnectionPool as Connector
    interface (#176).

    An example how to use queue and connection_pool subpackages
    together (#176).

Bugfixes

    Mode type description in the connection_pool subpackage (#208).

    Missed Role type constants in the connection_pool
    subpackage (#208).

    ConnectionPool does not close UnknownRole connections (#208).

    Segmentation faults in ConnectionPool requests after
    disconnect (#208).

    Addresses in ConnectionPool may be changed from an external
    code (#208).

    ConnectionPool recreates connections too often (#208).

    A connection is still opened after ConnectionPool.Close() (#208).

    Future.GetTyped() after Future.Get() does not decode response
    correctly (#213).

    Decimal package use a test function GetNumberLength instead of a
    package-level function getNumberLength (#219).

    Datetime location after encode + decode is unequal (#217).
oleg-jukovec added a commit that referenced this pull request Oct 31, 2022
Overview

    The release adds support for the latest version of the
    queue package with master-replica switching.

Breaking changes

    There are no breaking changes in the release.

New features

    Support the queue 1.2.1 (#177).

    ConnectionHandler interface for handling changes of connections in
    ConnectionPool (#178).

    Execute, ExecuteTyped and ExecuteAsync methods to
    ConnectionPool (#176).

    ConnectorAdapter type to use ConnectionPool as Connector
    interface (#176).

    An example how to use queue and connection_pool subpackages
    together (#176).

Bugfixes

    Mode type description in the connection_pool subpackage (#208).

    Missed Role type constants in the connection_pool
    subpackage (#208).

    ConnectionPool does not close UnknownRole connections (#208).

    Segmentation faults in ConnectionPool requests after
    disconnect (#208).

    Addresses in ConnectionPool may be changed from an external
    code (#208).

    ConnectionPool recreates connections too often (#208).

    A connection is still opened after ConnectionPool.Close() (#208).

    Future.GetTyped() after Future.Get() does not decode response
    correctly (#213).

    Decimal package use a test function GetNumberLength instead of a
    package-level function getNumberLength (#219).

    Datetime location after encode + decode is unequal (#217).

    Wrong interval arithmetic with timezones (#221).

    Invalid MsgPack if STREAM_ID > 127 (#224).

    queue.Take() returns an invalid task (#222).
oleg-jukovec added a commit that referenced this pull request Oct 31, 2022
Overview

    The release adds support for the latest version of the
    queue package with master-replica switching.

Breaking changes

    There are no breaking changes in the release.

New features

    Support the queue 1.2.1 (#177).

    ConnectionHandler interface for handling changes of connections in
    ConnectionPool (#178).

    Execute, ExecuteTyped and ExecuteAsync methods to
    ConnectionPool (#176).

    ConnectorAdapter type to use ConnectionPool as Connector
    interface (#176).

    An example how to use queue and connection_pool subpackages
    together (#176).

Bugfixes

    Mode type description in the connection_pool subpackage (#208).

    Missed Role type constants in the connection_pool
    subpackage (#208).

    ConnectionPool does not close UnknownRole connections (#208).

    Segmentation faults in ConnectionPool requests after
    disconnect (#208).

    Addresses in ConnectionPool may be changed from an external
    code (#208).

    ConnectionPool recreates connections too often (#208).

    A connection is still opened after ConnectionPool.Close() (#208).

    Future.GetTyped() after Future.Get() does not decode response
    correctly (#213).

    Decimal package use a test function GetNumberLength instead of a
    package-level function getNumberLength (#219).

    Datetime location after encode + decode is unequal (#217).

    Wrong interval arithmetic with timezones (#221).

    Invalid MsgPack if STREAM_ID > 127 (#224).

    queue.Take() returns an invalid task (#222).
oleg-jukovec added a commit that referenced this pull request Nov 2, 2022
Overview

    The release adds support for the latest version of the
    queue package with master-replica switching.

Breaking changes

    There are no breaking changes in the release.

New features

    Support the queue 1.2.1 (#177).

    ConnectionHandler interface for handling changes of connections in
    ConnectionPool (#178).

    Execute, ExecuteTyped and ExecuteAsync methods to
    ConnectionPool (#176).

    ConnectorAdapter type to use ConnectionPool as Connector
    interface (#176).

    An example how to use queue and connection_pool subpackages
    together (#176).

Bugfixes

    Mode type description in the connection_pool subpackage (#208).

    Missed Role type constants in the connection_pool
    subpackage (#208).

    ConnectionPool does not close UnknownRole connections (#208).

    Segmentation faults in ConnectionPool requests after
    disconnect (#208).

    Addresses in ConnectionPool may be changed from an external
    code (#208).

    ConnectionPool recreates connections too often (#208).

    A connection is still opened after ConnectionPool.Close() (#208).

    Future.GetTyped() after Future.Get() does not decode response
    correctly (#213).

    Decimal package use a test function GetNumberLength instead of a
    package-level function getNumberLength (#219).

    Datetime location after encode + decode is unequal (#217).

    Wrong interval arithmetic with timezones (#221).

    Invalid MsgPack if STREAM_ID > 127 (#224).

    queue.Take() returns an invalid task (#222).
oleg-jukovec added a commit that referenced this pull request Nov 2, 2022
Overview

    The release adds support for the latest version of the
    queue package with master-replica switching.

Breaking changes

    There are no breaking changes in the release.

New features

    Support the queue 1.2.1 (#177).

    ConnectionHandler interface for handling changes of connections in
    ConnectionPool (#178).

    Execute, ExecuteTyped and ExecuteAsync methods to
    ConnectionPool (#176).

    ConnectorAdapter type to use ConnectionPool as Connector
    interface (#176).

    An example how to use queue and connection_pool subpackages
    together (#176).

Bugfixes

    Mode type description in the connection_pool subpackage (#208).

    Missed Role type constants in the connection_pool
    subpackage (#208).

    ConnectionPool does not close UnknownRole connections (#208).

    Segmentation faults in ConnectionPool requests after
    disconnect (#208).

    Addresses in ConnectionPool may be changed from an external
    code (#208).

    ConnectionPool recreates connections too often (#208).

    A connection is still opened after ConnectionPool.Close() (#208).

    Future.GetTyped() after Future.Get() does not decode response
    correctly (#213).

    Decimal package use a test function GetNumberLength instead of a
    package-level function getNumberLength (#219).

    Datetime location after encode + decode is unequal (#217).

    Wrong interval arithmetic with timezones (#221).

    Invalid MsgPack if STREAM_ID > 127 (#224).

    queue.Take() returns an invalid task (#222).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants