Skip to content

[Bug]: failed timestamp related tests  #4032

Closed

Description

@lni

Is there an existing issue for the same bug?

  • I have checked the existing issues.

Environment

- Version or commit-id (e.g. v0.1.0 or 8b23a93):
- Hardware parameters:
- OS type:
- Others:

Actual Behavior

make ut reports following failed cases when the machine's timezone is not set to UTC.

FAILED CASES:

--- FAIL: TestUnix (0.00s)
--- FAIL: TestCastIntegerAsTimestamp (0.00s)
--- FAIL: TestFromUnixTimestamp (0.00s)
--- FAIL: TestUnixTimestamp (0.00s)

e.g. on a machine with its timezone set to CST +8000, I got -

=== RUN   TestUnix
    datetime_test.go:313: UnixTimestamp want -452961506 but got -452990306
    datetime_test.go:313: UnixTimestamp want 1327483294 but got 1327454494

It works fine on machines with timezone set to UTC.

@reusee mentioned that time.UTC().UnixTimestamp() should be used.

Expected Behavior

No response

Steps to Reproduce

No response

Additional information

No response

Activity

  1. added
    kind/bug
    on Jul 16, 2022
  2. self-assigned this
    on Jul 18, 2022
  3. aptend commented on Jul 19, 2022

    @aptend
    Contributor

    the fix has been merged, @lni doctor please have a try in your local machine~

  4. assigned and unassigned on Jul 19, 2022
  5. added
    severity/s1
    and removed on Oct 29, 2022
  6. assigned and unassigned on Oct 29, 2022
  7. added this to the v0.6.0 milestone on Oct 29, 2022
  8. aressu1985 commented on Oct 30, 2022

    @aressu1985
    Contributor

    fixed

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

Metadata

Metadata

Assignees

Labels

kind/bugseverity/s1

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions