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

use DateTime consistently in Base for time() / now() / stat() / etc. #15405

Closed
vtjnash opened this issue Mar 8, 2016 · 6 comments
Closed

use DateTime consistently in Base for time() / now() / stat() / etc. #15405

vtjnash opened this issue Mar 8, 2016 · 6 comments
Labels
good first issue Indicates a good issue for first-time contributors to Julia Hacktoberfest Good for Hacktoberfest participants

Comments

@vtjnash
Copy link
Member

vtjnash commented Mar 8, 2016

part of the reason DateTime was added to base is so that times could be expressed consistently as objects (locale-aware and dimension) rather than raw numbers (Float64)

@vtjnash vtjnash added the good first issue Indicates a good issue for first-time contributors to Julia label Mar 8, 2016
@denisli
Copy link

denisli commented Mar 26, 2016

Is this issue still open? I'm new here and would like to try this out if it is still open.

But I have trouble finding where these changes need to be made. Are you referring to the time() method which currently returns Int? I cannot find where it is implemented. Also, Dates.now() already returns DateTime. I also am not sure what stat() means. I cannot find a stat() method that relates to time.

Thanks.

@quinnj
Copy link
Member

quinnj commented Mar 26, 2016

@denisli, yes this issue is still opening. Take a look in the Libc.jl file/module for the stat/time functions.

@kshyatt kshyatt added the Hacktoberfest Good for Hacktoberfest participants label Oct 5, 2016
@tkelman
Copy link
Contributor

tkelman commented Oct 16, 2016

I'm not sure if this is the best thing to do given #5155 and the desire for modularity. Wouldn't it be more idiomatic to make most of these accept an output type argument, then you could choose what output type (and module dependencies) you want? If we want to change the default to depend on Dates types, then Dates should define the version without an output type argument, rather than Base.

And what's the deprecation path here?

@JeffBezanson
Copy link
Member

I would say

  1. This might be a case where we should separate the DateTime type and basic functions from date and period math; maybe a DateMath library.
  2. It seems silly for Base to export both now and time (time is also unrelated to @time, and so a bit confusing). time should be un-exported and possibly deprecated entirely.
  3. The purpose of the Libc module is to wrap libc functions, so Libc.time should return the same value that the libc function returns. If that's not useful, deletion is always an option. File mtime is a borderline case; our mtime can probably return a DateTime if we want.

@praveshcj
Copy link

praveshcj commented Dec 16, 2020

Hello. Is this issue still open? I am new to open source contributions and would like to start working on this issue.

@StefanKarpinski
Copy link
Member

I think we're really moved in the other direction here and fortuitously ended up where we should be: Base uses UNIX timestamps for time and does not depend on the Dates package. Only if you want to work with Date and DateTime objects do you depend on Dates and you can use now() instead of time(). This seems like a good and reasonable division and allows Dates to live entirely outside of Base cleanly.

@vtjnash vtjnash closed this as not planned Won't fix, can't repro, duplicate, stale Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Indicates a good issue for first-time contributors to Julia Hacktoberfest Good for Hacktoberfest participants
Projects
None yet
Development

No branches or pull requests

8 participants