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

Bring all disparate datetime handling into core helpers module. #1051

Merged
merged 8 commits into from
Aug 12, 2015

Conversation

dhermes
Copy link
Contributor

@dhermes dhermes commented Aug 11, 2015

Fixes #1024.

This is best reviewed commit by commit. I'm happy to break it into more PRs if desired.

This way we can test all code-paths, just not the branch
where Python 2.6 is active.
Using a method to convert to microseconds (which handles
both naive datetime objects and ones with timezones other
than UTC) and then converts them to microseconds. All
consumers then convert to the desired granularity.
Also making it require a float (or int) instead of bailing
out for NoneType. Changing the use of the method in
bigquery to not pass potentially null values and to multiply
by 1000.0 (convert from millis to micros). Also updating
micros -> datetime conversion in datastore to use the newly
converted method.
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Aug 11, 2015
:returns: milliseconds since epoch for ``when``
"""
micros = _microseconds_from_datetime(when)
millis, _ = divmod(micros, 1000)

This comment was marked as spam.

This comment was marked as spam.

@tseaver
Copy link
Contributor

tseaver commented Aug 12, 2015

Other than the one quibble, LGTM

@dhermes
Copy link
Contributor Author

dhermes commented Aug 12, 2015

Addressed divmod there and elsewhere (all added in this PR, and removed in the final commit).

dhermes added a commit that referenced this pull request Aug 12, 2015
Bring all disparate datetime handling into core helpers module.
@dhermes dhermes merged commit d3956db into googleapis:master Aug 12, 2015
@dhermes dhermes deleted the fix-1024 branch August 12, 2015 18:30
This was referenced Aug 12, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: core cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants