Earlier quoted context omitted.
> When the mapping between a time_t and a "human readable format" (hours, minutes, seconds, etc) takes into account extra leap seconds. I still don't understand what you mean. > You could use time_t underneath, if that's what you really wanted to do. Well you've got unix timestamp (UTC) which "skips" leap seconds but as a result is very easy to map to "human time", or you've got TAI[0] which includes leap seconds but…
What I believe he's trying to say is that sometimes, you need a library capable of the following: 2016-12-31T23:59:30Z + 60s == 2017-01-01T23:59:29Z (The above is a true statement, due to the presence of a leap second in the duration.) Python does not do this: In [5]: datetime.datetime(2016, 12, 31, 23, 59, 30, tzinfo=pytz.UTC) + datetime.timedelta(seconds=60) Out[5]: datetime.datetime(2017, 1, 1, 0, 0, 30, tzinfo= )…
Maya – Python Datetimes for Humans
171–180 of 180 posts
Re: Maya – Python Datetimes for Humans
#172Earlier quoted context omitted.
I think that would only work for day long ranges. What if I want the events that happened in the last hour, or that are scheduled for May?
Combine pure dates and times with timedelta[1]? Python's multiple comparison expressions help here too. For events in the last hour, the following expression should evaluate to True: (datetime.now() - timedelta(hours=1)) Checking whether event_datetime is within May of the current year is a bit more involved, but you may not need to convert everything to a date (would have to check in an interpreter): date.today().re…
event_datetime in daterange(timedelta(hours=1), before=datetime.now())Re: Maya – Python Datetimes for Humans
#173Earlier quoted context omitted.
> When the mapping between a time_t and a "human readable format" (hours, minutes, seconds, etc) takes into account extra leap seconds. I still don't understand what you mean. > You could use time_t underneath, if that's what you really wanted to do. Well you've got unix timestamp (UTC) which "skips" leap seconds but as a result is very easy to map to "human time", or you've got TAI[0] which includes leap seconds but…
What I believe he's trying to say is that sometimes, you need a library capable of the following: 2016-12-31T23:59:30Z + 60s == 2017-01-01T23:59:29Z (The above is a true statement, due to the presence of a leap second in the duration.) Python does not do this: In [5]: datetime.datetime(2016, 12, 31, 23, 59, 30, tzinfo=pytz.UTC) + datetime.timedelta(seconds=60) Out[5]: datetime.datetime(2017, 1, 1, 0, 0, 30, tzinfo= )…
No, but I think we're interpreting the word "skipping" differently which leads to confusion. To me, in TAI, a "leap second" is nothing special and included in the normal time stream, in UTC the leap second is removed from the normal time stream and tacked on as a special case on some specific days, hence skipping it, hence UTC running late compared to TAI: UTC has "removed" 36 seconds from the timestream compared to UTC.
> Unix/POSIX time might not skip leap seconds
UNIX/POSIX can only ignore leap seconds, how it does so doesn't matter, because it's defined as constant-length days, the timestamp is 86400days since epoch + seconds since midnight. The day after a leap second, that leap second has "disappeared" from the timestamp sequence.
> However, Unix/POSIX time is not UTC.
Unix time is specifically defined as UTC (at least after January 1st 1972 since that's when UTC was defined, pre-72 it's ambiguous), though not true since it can't represent* leap seconds. Outside of the extent of leap seconds, UNIX time tracks UTC exactly.
> as leap seconds are an inherent property of UTC.
They're an inherent property of UTC in that it removes them from normal time treatment.
> TAI does not include leap seconds[1]:
It includes them in the sense that it treats them as perfectly normal seconds without anything special about them.
> With the above, it should be obvious that this is a property of UTC, not TAI.
The paragraph you're quoting here (and my entire comment really) is talking about how these systems map to human time aka year/month/day/hour/minutes/seconds. Leap seconds were introduced specifically for that purpose, and UTC (and unix timestamps) are thus trivially mappable by definition.
Because it does not, TAI can't be mapped to human time without leap seconds definition AKA May 7th, 2078 at 17:54:33 is known in UTC, but not known in TAI, because we don't know how many leap seconds will be introduced in the next 61 years and that's necessary to map TAI to and from human time.
Re: Maya – Python Datetimes for Humans
#174Re: Maya – Python Datetimes for Humans
#175Earlier quoted context omitted.
The way Kennet went is "the API is everything". Well, for requests, yes. But for maya, his API is in now way an improvment for existing tech, so we don't gain much. But there is such a thing as having too many choices, and yes, him working on this project instead of the other one will have an impact : dividing attentions, publicity, everything, tutorials, everything.
> him working on this project instead of the other one will have an impact : dividing attentions, publicity, everything, tutorials, everything. First of all, lets acknowledge that nobody really has the right to tell Kenneth what he should do. Having "too" many choices is merely a symptom of not having the best choice. Remember back when Google hadn't won the search engine war? Imagine someone had told the google-guys…
No. Just because somebody is good at what he does doesn't shield him magically from critics. As lib users, we have opinions and they matters.
> Having "too" many choices is merely a symptom of not having the best choice.
No, it's the symptom of not having a standard yet. The nice alternative arrived in the last 2 years, and didn't win the war yet. But they exist. And right now they ARE better than datetime and maya.
But but you are twisting my words here, because I never told him what to do, I just express my wish he would do overwise. Which is totally fine.
> Imagine someone had told the google-guys that they should just contribute to DogPile or AskJeeves?
DogPile or Askjeeves where neither "good" nor opensource. Propriotary software are _absolutly_ not the same. And they brought something on the table, which maya does not.
> And it isn't a choice of him working on his project, or some existing one. The choice is him working on this project or not at all.
This is a supposition, not backed up by anything.
> And given that he has a proven track record at producing brilliant stuff when he goes his own way, we would all be better off letting him get on with it.
Just because somebody does something great doesn't mean he can't do something that isn't. And even if maya enventually becomes the best possible implementation. Event if I'm wrong. So what ? Open source is a collective efforts, you need the opinions of your peer to make decisions. Or else what's the point ?
Re: Maya – Python Datetimes for Humans
#176Awesome! Timekeeping is hard and I'm glad we now have one more tool do deal with it. One thing that is bothering me is that when you ask for `maya.when('tomorrow')`, or give only a date, you get back a timestamp with millisecond precision, representing 00:00 of that day. I understand this simplifies the implementation, but shouldn't `tomorrow` be a range , from 00:00 to 23:59? Treating imprecise dates as ranges would…
https://github.com/kennethreitz/maya/issues/10#issuecomment-...
Re: Maya – Python Datetimes for Humans
#177Earlier quoted context omitted.
Using one of the most extreme edge cases is not a good argument. How often is Samoa (or another small dateline-neighbour country) going to 'jump sides'?
> Using one of the most extreme edge cases is not a good argument. 1. How is it not a good argument? It's an actual historical fact which is not yet 5 years old rather than some intellectual exercise, you can hardly go better than "this stuff happened not 5 years ago". 2. The only "extreme" part here is the magnitude of the drift, it's a clear example and demonstration of the issue. > How often is Samoa going to 'jum…
It's actual historic fact that the gregorian calendar we use skipped 11 days, but I don't see your suggestion solving that. Again, it was "just magnitude".
> Does it matter if your calendar is 24h off or 6h off? Your system is FUBAR either way.
Your theoretical appointment-haver might not blink at an appointment at a normal time + 1 day in the future, but might blink when their appointments start in the early afternoon and continue until midnight.
The fact is that if you skip days, then it doesn't matter if you use local or UTC time.
> are you somehow trying to win a prize in missing the point?
I'm not the cretin who thinks that timekeeping is a binary good/bad state. Some applications have troubles when they're milliseconds out. Others have quite a bit of lag time that they can handle. A daily to-do list just needs to appear on the right day, for example; DST means little to it.
Re: Maya – Python Datetimes for Humans
#178Earlier quoted context omitted.
Using one of the most extreme edge cases is not a good argument. How often is Samoa (or another small dateline-neighbour country) going to 'jump sides'?
Timezones change all the time . There are almost 200 countries in the world, some so large that even their sub-states can and do change timezone rules on their own (US, Russia, India, China...). This is why Linux distributions have a dedicated package listing timezone info that is updated almost weekly, and Windows has similar arrangements. Any solid datetime implementation better consider that time is not, in fact,…
Re: Maya – Python Datetimes for Humans
#179Earlier quoted context omitted.
> him working on this project instead of the other one will have an impact : dividing attentions, publicity, everything, tutorials, everything. First of all, lets acknowledge that nobody really has the right to tell Kenneth what he should do. Having "too" many choices is merely a symptom of not having the best choice. Remember back when Google hadn't won the search engine war? Imagine someone had told the google-guys…
> First of all, lets acknowledge that nobody really has the right to tell Kenneth what he should do. No. Just because somebody is good at what he does doesn't shield him magically from critics. As lib users, we have opinions and they matters. > Having "too" many choices is merely a symptom of not having the best choice. No, it's the symptom of not having a standard yet. The nice alternative arrived in the last 2 year…
You have an opinion, but it doesn't necessarily matter. You don't own Kenneth and have no right to instruct him. That's the point. Presuming to tell him what to do is almost as bad.
> No, it's the symptom of not having a standard yet.
Where do you imagine "standards" come from? Surely the BEST choice should win and become the standard, right?
> DogPile or Askjeeves where neither "good" nor opensource.
Not being "good" is the point. They were not in contravention of any "standard". They were not good, so they died.
Not being "opensource", well that's just your irrelevant fetish. The source being open does not mean you can arrogantly denounce the work patterns of your betters.
> This is a supposition, not backed up by anything.
It is backed up by his history of actions and accomplishments.
> Just because somebody does something great doesn't mean he can't do something that isn't.
It means he has earned the right not to be scolded by the dogs eating his table scraps.
> Open source is a collective efforts, you need the opinions of your peer to make decisions.
Utter crap. Open source is a collection of individual efforts. There is no such thing as "collective effort".
It really looks as if that is just something you tell yourself so you can feel as if you are "contributing". And that's pretty sad.
Re: Maya – Python Datetimes for Humans
#180Earlier quoted context omitted.
> It's puzzling why this doesn't wrap np.datetime64 instead. Perhaps to avoid the numpy dependency. I've found numpy a bit heavy and wouldn't want to depend on it simply for the sake of some datetime syntax. May be boost.datetime or even numpy's implementantion on datetime, but that sounds like a lot of maintenance.
Agree, 100%. E.g. numpy in a virtual environment can be a real pain. Best case, it takes a bit longer to install. Worst case, it's on a system that's missing some OS specific dependencies. "Works for me" is not okay for stuff on PyPI.