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

Equality Comparison (and Others) Disregard Microseconds #156

Open
DavidMuller opened this issue May 22, 2018 · 5 comments
Open

Equality Comparison (and Others) Disregard Microseconds #156

DavidMuller opened this issue May 22, 2018 · 5 comments
Assignees

Comments

@DavidMuller
Copy link
Contributor

DavidMuller commented May 22, 2018

The equality operators (e.g. __eq__) and other properties (e.g. .epoch) seem to ignore + truncate microseconds:

In [2]: m1, m2 = maya.now(), maya.now()

In [3]: m1
Out[3]: <MayaDT epoch=1527031930.399905>

In [4]: m2
Out[4]: <MayaDT epoch=1527031930.399909>

In [5]: m1 == m2
Out[5]: True

In [6]: m1.datetime() == m2.datetime()
Out[6]: False

In [7]: m1.epoch
Out[7]: 1527031930

Is this microsecond truncation behavior intentional? It seems to disagree with datetime's microsecond treatment, with the __repr__ of MayaDT itself, and with other MayaDT methods (e.g. .datetime(), . iso8601(), and of course .microsecond)

Thanks for this package!

@timofurrer
Copy link
Collaborator

Is this microsecond truncation behavior intentional?

I'm not entirely sure about this. The only reference in the commit history I could find was about simplifying the test suite - which is kinda strange ;)

I've committed #157 to be at least compatible with Python's datetime comparison methods.
However, I'm not entirely sure how to deal with MayaDT.epoch. The POSIX timestamp / UNIX epoch is usually specified in seconds and not microseconds.

@timofurrer timofurrer self-assigned this May 26, 2018
@DavidMuller
Copy link
Contributor Author

Thanks for the update @timofurrer -- I'll follow along with the discussion in PR #157

@github-actions
Copy link

This Issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

@github-actions
Copy link

This Issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

@github-actions
Copy link

This Issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

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

2 participants