Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Aug 03 04:54
    praveentiru edited #579
  • Aug 03 04:51
    praveentiru commented #579
  • Aug 03 00:31
    praveentiru opened #579
  • Jul 30 10:29
    timvisee commented #567
  • Jul 30 10:28
    timvisee edited #578
  • Jul 30 10:28
    timvisee edited #578
  • Jul 30 10:21
    timvisee edited #578
  • Jul 30 10:20
    timvisee commented #567
  • Jul 30 10:19
    timvisee ready_for_review #578
  • Jul 30 10:18
    timvisee edited #578
  • Jul 30 10:18
    timvisee synchronize #578
  • Jul 30 10:15
    timvisee edited #578
  • Jul 30 10:15
    timvisee synchronize #578
  • Jul 29 16:41
    timvisee commented #578
  • Jul 29 16:11
    timvisee edited #578
  • Jul 29 16:11
    timvisee edited #578
  • Jul 29 16:11
    timvisee synchronize #578
  • Jul 29 15:47
    timvisee commented #578
  • Jul 29 15:46
    timvisee commented #578
  • Jul 29 15:45
    timvisee commented #578
Brandon W Maister
@quodlibetor
yeah I believe that that should be fine in 100% of cases
like unless the government literally deletes a day after the fact or something
or more realistically if your tzdata file changes after the time was stored because it had bugs
the international tzdb recently had a bug in brazil I think? so it does happen
Adam Wright
@shaladdle
Yeah, makes sense. Bugs are hard to avoid.
Buy Bitcoin [uDevNull]
@udevnull_twitter
Hey guys, any idea how I can get a timezone as an int of some sorts?
Brandon W Maister
@quodlibetor
what kind of int would you like it to be?
FixedOffset::local_minus_utc will give you "minutes away from utc" @udevnull_twitter https://docs.rs/chrono/0.4.11/chrono/offset/struct.FixedOffset.html#method.local_minus_utc
heca-project
@heca-project
Would it be possible to add Duration to NaiveDateTime without checking for overflow? I do a lot of adding and I check for overflows outside the main loop, so it wouldn't overflow anyways.
Brandon W Maister
@quodlibetor
@heca-project yeah we could add some _unchecked methods, I'd be happy to take a PR.
Jonathan Dickinson
@jcdickinson
Hey! I have fixed a test in my project that fails on my machine/time-zone (related to DST), [edit] and want to make sure that it is tested correctly on the CI server. Is there a way to fake the timezone in Chrono for testing purposes?
Benno Rice
@jeamland
Hi, I'm looking at #380 / #384 and seeing if I can implement a version of Period that is generic over Datelike + Timelike however the biggest issue there is that it really wants to work off a "DateTimelike" that can do things like work out what a "DateTimelike" + a Duration is.
An idea how I'd go about tweaking things so I had that?
Brandon W Maister
@quodlibetor
@jcdickinson sorry I missed your chat, you should be able to test by using the chrono-tz package for the timezone?
@jeamland are you referring to the issue I mentioned in this comment? https://github.com/chronotope/chrono/pull/384#discussion_r363054371
Benno Rice
@jeamland
@quodlibetor Yep, exactly.
I'm spiking something that ends up moving a bunch of methods around (e.g. .and_time() moves on to Datelike and a lot of .timestamp*() methods move on to a new DateTimelike) but it's fairly drastic.
I think you end up with less churn if you have Period and NaivePeriod. Otherwise you could move a lot of functionality into Datelike/Timelike/DateTimelike or you could do away with Naive* entirely in some way (either by assuming UTC unless otherwise specified or by making the TimeZone inside a Date/Time/DateTime be an Option of some kind).
Brandon W Maister
@quodlibetor
I'd be happy to take a look at WIP PRs for detailed discussion!
I don't want to break backwards compatibility, but I'd be happy to look at things that do break backcompat as part of brainstorming solutions
Michael-J-Ward
@Michael-J-Ward
Any pointers on tracking down the trigger for LocalResult::None => panic!("No such local time")
Brandon W Maister
@quodlibetor
that should mean that you are trying to construct a timestamp within a DST transition, you can use the _opt version of the method you were calling to have chrono return the result, or set RUST_BACKTRACE=1 to figure out where it was being called.
Michael-J-Ward
@Michael-J-Ward
+1, I believe it's from a timestamp being parsed from a 3rd party. The only timestamps created within the app are UTC
Michael-J-Ward
@Michael-J-Ward
RUST_BACKTRACE=1
thread 'main' panicked at 'No such local time', /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/chrono-0.4.11/src/offset/mod.rs:173:34
stack backtrace:
   0: std::panicking::begin_panic
   1: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
   2: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
   3: <tokio::future::poll_fn::PollFn<F> as core::future::future::Future>::poll
   4: exchange_data_capture::spreader_runner::start_spreader::{{closure}}
   5: <tokio::future::maybe_done::MaybeDone<Fut> as core::future::future::Future>::poll
   6: <tokio::future::poll_fn::PollFn<F> as core::future::future::Future>::poll
   7: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
   8: std::thread::local::LocalKey<T>::with
   9: tokio::runtime::enter::Enter::block_on
  10: tokio::runtime::thread_pool::ThreadPool::block_on
  11: tokio::runtime::context::enter
  12: grpc_server::main
Brandon W Maister
@quodlibetor
my guess is that you're calling a chrono method that panics instead of returns an error in 4: exchange_data_capture::spreader_runner::start_spreader::{{closure}}
the fact that chrono inlines many methods cand mean that it doesn't show up in backtraces, I suppose? I haven't seen that much
Jake Vossen
@jakevossen5
Any reason the Sum trait is not implemented for Duration?
I can open up an issue if that is a better place for this
Jake Vossen
@jakevossen5
(I went ahead and opened this: chronotope/chrono#520)
José Miguel Sánchez García
@jmi2k
Hello! Came to ask something
When parsing a time with NaiveTime::parse_from_str, at least hour and minutes are required for it to suceed. I want to parse a time which is expressed only with the hour (9PM), which I think can be widely understood to mean 21:00:00. What is the reason behind not allowing this kind of common notation?
Jake Vossen
@jakevossen5
Lol I am working exactly on this right now
Let me find the issue
Does that fit your requirements?
José Miguel Sánchez García
@jmi2k
I kinda like the second option
Changing function signatures is always messy because it breaks code, and also only one of the returned values would be useful. Adding new functions seems a better idea
Jake Vossen
@jakevossen5
Yeah basically you’ll be able to specify default seconds / minutes.
José Miguel Sánchez García
@jmi2k
However, I think defaulting to zero is a great idea. Can you provide a counter-example of when interpreting missing minutes/seconds as 0 can lead to problems? I can't find any right now.
(also, seconds are already being defaulted to 00 if they are not present)
Jake Vossen
@jakevossen5
I could see a situation where someone wanted to default to 30. At least going off what @quodlibetor said in that issue, we can implement the generic case then offer a function that specifies it defaults to zero. Does that make sense?
I am new to this project so @quodlibetor is probably your go to for more design decisions
José Miguel Sánchez García
@jmi2k
Don't get me wrong: what you suggest is indeed the most sensible, flexible and explicit approach, although IMHO a bit less convenient. But I'm willing to lose that bit of convenience in the name of doing The Right Thing! I've just made what I need in a private fork, and I'll switch back to upstream chrono when it gets implemented! Thanks :)
Jake Vossen
@jakevossen5
Sounds good. I imagine part of it is it is kinda off spec? Maybe someone reading around here knows more, but from my reading of 8601, T01 is not short hand for 01:00:00, it just refers to the general "01" hour. In my head, chrono will have functions that allow you to specify your own defaults, and functions that will default to zero.
José Miguel Sánchez García
@jmi2k
It may be the case, and a pretty good reason not to default to zero so lightly...
Will
@LMJW
Hi all, is it possible to parse time with optional section? Just like in https://stackoverflow.com/questions/51176936/java-8-datetimeformatter-parsing-optional-sections ?
Like HH:MM:[SS] and SS is optional ?
Jake Vossen
@jakevossen5
Yeah there is this GitHub issue that I haven’t really had the time to try and fix it yet chronotope/chrono#528
0x5c
@0x5c
Hello! I've looked though the documentation and it seems that there is no exposed way to get the available precision (0/3/6/9 digits after seconds) of a DateTime. Did I just miss it?
ok-nick
@ok-nick
I'm trying to deserialize a NaiveDateTime, although for some reason it errors with "trailing input". Does deserializing a NaiveDateTime from a String not assume its format is ISO 8601? What are the best ways to get around this?
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=836fac98df345c97cf9241b89c273fa5