Skip to content

nt/common: fix Python-2 _dt2posix using * instead of + for microseconds#216

Open
jacquelinegarrahan wants to merge 1 commit into
epics-base:masterfrom
jacquelinegarrahan:fix/common-py2-dt2posix
Open

nt/common: fix Python-2 _dt2posix using * instead of + for microseconds#216
jacquelinegarrahan wants to merge 1 commit into
epics-base:masterfrom
jacquelinegarrahan:fix/common-py2-dt2posix

Conversation

@jacquelinegarrahan

Copy link
Copy Markdown

The py2 fallback computed _timegm(dt.timetuple()) * dt.microsecond*1e-6,
multiplying the epoch seconds by the fractional part (and yielding 0 whenever
microsecond==0) instead of adding the sub-second offset. Only reachable on
Python 2 (py3 uses datetime.timestamp), but the result there was grossly
wrong.

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

The py2 fallback computed `_timegm(dt.timetuple()) * dt.microsecond*1e-6`,
multiplying the epoch seconds by the fractional part (and yielding 0 whenever
microsecond==0) instead of adding the sub-second offset. Only reachable on
Python 2 (py3 uses datetime.timestamp), but the result there was grossly
wrong.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

1 participant