Skip to content

std::time is stunted #17536

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

Closed
Manishearth opened this issue Sep 25, 2014 · 6 comments
Closed

std::time is stunted #17536

Manishearth opened this issue Sep 25, 2014 · 6 comments

Comments

@Manishearth
Copy link
Member

The only thing std::time contains is Duration, which isn't too useful on its own. The real meat of it is in ::time.

Perhaps one should be moved into the other?

Alternatively, we can add some docs to Duration that explain how to work with it. One common way of getting a Duration is to subtract two instances of time::now().to_timespec()s, however this is completely not obvious on std::time. I don't mind adding these docs.

@aturon
Copy link
Member

aturon commented Sep 25, 2014

cc me

@bluss
Copy link
Member

bluss commented Sep 26, 2014

It seems to be a nice model where libstd defines a common type or trait and 3rd party packages can use those. The benefit is possibly better cross-library compatibility. The only hazard is that the libstd parts need to be well designed, so that they are actually useful and will be used by other packages.

@nodakai
Copy link
Contributor

nodakai commented Sep 27, 2014

Some folks attempts to use Rust to write a OS kernel or a Linux kernel module without libstd (and I'm really excited to see progresses in this area.) When they need to define an interface involving timeout (eg. include/linux/ktime.h,) time::Timespec, as well as std::time::duration::Duration in theory, will be valuable. (However time::Tm will be meaningless without tz database usually maintained by OS.)

I think libstd should be an umbrella crate linking to other smaller crates in the standard library.

@Manishearth
Copy link
Member Author

Any ideas on what should be done then? I'm willing to RfC this if necessary, but a general idea of which way we should go (moving into or out of std) would be nice. If people want the status quo, I'll try to add some doc comments.

@pnathan
Copy link

pnathan commented Oct 4, 2014

Declaration:

std::time should allow datetime manipulations (arguably it should be std::datetime). That would provide a clear & obvious place to find time code. Having the time code in two separate locations doesn't make things obvious.

Further, a cursory inspection suggests that the types in each module are different, inhibiting the natural coupling in time modules.

@ghost ghost self-assigned this Dec 12, 2014
@steveklabnik
Copy link
Member

This is effectively a duplicate of rust-lang/rfcs#619 today, so I'm giving it a close.

lnicola pushed a commit to lnicola/rust that referenced this issue Jul 11, 2024
fix: Don't emit semantic diagnostics in files with a lot of syntax errors

These will only add to the noise when something very unexpected breaks or where parser recovery fails to kick in.
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

No branches or pull requests

6 participants