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

Dates: add constructor DateTime(::Date, ::Time) #29754

Merged
merged 1 commit into from Oct 27, 2018

Conversation

4 participants
@iblis17
Copy link
Member

commented Oct 21, 2018

No description provided.

```
"""
DateTime(d::Date, t::Time) =
DateTime(UTM(value(d) * 86400000 + value(t) / 1000000))

This comment has been minimized.

Copy link
@quinnj

quinnj Oct 23, 2018

Member

Hmm, this isn't quite right because Time internal values aren't normalized down; i.e. Dates.value(Time(0,0,0)) != Dates.value(Time(0,0,0) + Dates.Hour(24)). I would maybe just mirror the definition of +(d::Date, t::Time) here

This comment has been minimized.

Copy link
@iblis17

iblis17 Oct 23, 2018

Author Member

If I define it as DateTime(UTM(value(d) * 86400000 + (value(t) / 1000000) % 86400000)),
seems works.
There are no significant performance differences between mine and +, so I mirrored the +(d::Date, t::Time).

This comment has been minimized.

Copy link
@quinnj

quinnj Oct 24, 2018

Member

It seems a bit backwards to me to have something in types.jl depend on something arithmetic.jl; would you mind switching the definitions around? i.e. have types.jl define the actual definition and then change the arithmetic.jl definition to just call DateTime(dt, t)? It might just save some headache down the road if further refactoring is done (keeping the dependency graph clean and all that...)

This comment has been minimized.

Copy link
@iblis17

iblis17 Oct 24, 2018

Author Member

ok ,sure

@iblis17 iblis17 force-pushed the iblis17:ib/datetime branch from 3588bf8 to 9831354 Oct 23, 2018

@kshyatt kshyatt added the dates label Oct 23, 2018

@iblis17 iblis17 force-pushed the iblis17:ib/datetime branch from 9831354 to ebfb4be Oct 24, 2018

@ararslan ararslan added the stdlib label Oct 26, 2018

@quinnj

quinnj approved these changes Oct 27, 2018

@quinnj quinnj merged commit ab25ae4 into JuliaLang:master Oct 27, 2018

3 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
julia freebsd ci Build done
Details

@iblis17 iblis17 deleted the iblis17:ib/datetime branch Oct 27, 2018

fredrikekre added a commit that referenced this pull request Nov 30, 2018

fredrikekre added a commit that referenced this pull request Nov 30, 2018

fredrikekre added a commit that referenced this pull request Dec 1, 2018

fredrikekre added a commit that referenced this pull request Dec 1, 2018

fredrikekre added a commit that referenced this pull request Dec 3, 2018

fredrikekre added a commit that referenced this pull request Dec 4, 2018

fredrikekre added a commit that referenced this pull request Dec 4, 2018

fredrikekre added a commit that referenced this pull request Dec 5, 2018

Addition of NEWS and compat admonitions for important
changes between Julia 1.0 and 1.1, including:

- Custom .css-style for compat admonitions.

- Information about compat annotations to CONTRIBUTING.md.

- NEWS.md entry for PRs #30090, #30035, #30022, #29978,
  #29969, #29858, #29845, #29754, #29638, #29636, #29615,
  #29600, #29506, #29469, #29316, #29259, #29178, #29153,
  #29033, #28902, #28761, #28745, #28708, #28696, #29997,
  #28790, #29092, #29108, #29782

- Compat annotation for PRs #30090, #30013, #29978,
  #29890, #29858, #29827, #29754, #29679, #29636, #29623,
  #29600, #29440, #29316, #29259, #29178, #29157, #29153,
  #29033, #28902, #28878, #28761, #28708, #28156, #29733,
  #29670, #29997, #28790, #29092, #29108, #29782, #25278

- Documentation for broadcasting CartesianIndices (#30230).
- Documentation for Base.julia_cmd().
- Documentation for colon constructor of CartesianIndices (#29440).
- Documentation for ^(::Matrix, ::Number) and ^(::Number, ::Matrix).

- Run NEWS-update.jl.

Co-authored-by: Morten Piibeleht <morten.piibeleht@gmail.com>
Co-authored-by: Fredrik Ekre <ekrefredrik@gmail.com>

fredrikekre added a commit that referenced this pull request Dec 5, 2018

Addition of NEWS and compat admonitions for important
changes between Julia 1.0 and 1.1, including:

- Custom .css-style for compat admonitions.

- Information about compat annotations to CONTRIBUTING.md.

- NEWS.md entry for PRs #30090, #30035, #30022, #29978,
  #29969, #29858, #29845, #29754, #29638, #29636, #29615,
  #29600, #29506, #29469, #29316, #29259, #29178, #29153,
  #29033, #28902, #28761, #28745, #28708, #28696, #29997,
  #28790, #29092, #29108, #29782

- Compat annotation for PRs #30090, #30013, #29978,
  #29890, #29858, #29827, #29754, #29679, #29636, #29623,
  #29600, #29440, #29316, #29259, #29178, #29157, #29153,
  #29033, #28902, #28878, #28761, #28708, #28156, #29733,
  #29670, #29997, #28790, #29092, #29108, #29782, #25278

- Documentation for broadcasting CartesianIndices (#30230).
- Documentation for Base.julia_cmd().
- Documentation for colon constructor of CartesianIndices (#29440).
- Documentation for ^(::Matrix, ::Number) and ^(::Number, ::Matrix).

- Run NEWS-update.jl.

Co-authored-by: Morten Piibeleht <morten.piibeleht@gmail.com>
Co-authored-by: Fredrik Ekre <ekrefredrik@gmail.com>

fredrikekre added a commit that referenced this pull request Dec 5, 2018

Compat admonitions and NEWS for Julia 1.1 (#30230)
Addition of NEWS and compat admonitions for important changes between Julia 1.0 and 1.1, including:

- Custom .css-style for compat admonitions.

- Information about compat annotations to CONTRIBUTING.md.

- NEWS.md entry for PRs #30090, #30035, #30022, #29978,
  #29969, #29858, #29845, #29754, #29638, #29636, #29615,
  #29600, #29506, #29469, #29316, #29259, #29178, #29153,
  #29033, #28902, #28761, #28745, #28708, #28696, #29997,
  #28790, #29092, #29108, #29782

- Compat annotation for PRs #30090, #30013, #29978,
  #29890, #29858, #29827, #29754, #29679, #29636, #29623,
  #29600, #29440, #29316, #29259, #29178, #29157, #29153,
  #29033, #28902, #28878, #28761, #28708, #28156, #29733,
  #29670, #29997, #28790, #29092, #29108, #29782, #25278

- Documentation for broadcasting CartesianIndices (#30230).
- Documentation for Base.julia_cmd().
- Documentation for colon constructor of CartesianIndices (#29440).
- Documentation for ^(::Matrix, ::Number) and ^(::Number, ::Matrix).

- Run NEWS-update.jl.


Co-authored-by: Morten Piibeleht <morten.piibeleht@gmail.com>
Co-authored-by: Fredrik Ekre <ekrefredrik@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.