cmaloney | morning | 14:39 |
---|---|---|
Zimdale | Morning | 14:40 |
rick_h | party | 14:45 |
cmaloney | are we having fun yet? | 17:10 |
jrwren | YES | 17:10 |
jrwren | I really want to write strtotime in go, but I'm afraid I'll hit a wall. What do you think I should do? | 17:11 |
cmaloney | shell out to C? ;) | 17:12 |
jrwren | I'd rather not. | 17:12 |
cmaloney | use Python like a gentleman | 17:12 |
notlikethesoup | python++ | 17:12 |
notlikethesoup | erm... python += 1 | 17:13 |
jrwren | so... I call strtotime from python, because python datetime parsing sucks. | 17:13 |
jrwren | that is a wrapped C function because python calls C nicely. | 17:13 |
cmaloney | Python Datetime parsing is pretty awesome | 17:14 |
cmaloney | using dateutils | 17:14 |
jrwren | terrible. | 17:14 |
jrwren | j/k. i never used it because I had strtotime. | 17:14 |
cmaloney | https://pypi.python.org/pypi/python-dateutil/2.6.1 | 17:14 |
cmaloney | I'd be afraid to write anything related to time because it's a clusterfuck of exceptions | 17:15 |
cmaloney | and I'd wind up writing 0:60:01 or some shit | 17:15 |
greg-g | I just was handed a smoothie with frozen peaches in it, so yeah, having fun now | 17:15 |
jrwren | mmm... peaches. | 17:15 |
jrwren | well, my job is all about video playback which is time based, so yeah... time and a clusterfuck of exceptions is my job now. | 17:16 |
greg-g | yeah, the big flat of them we got from costco were good, but a few got soft spots before we could eat them, so, into the freezer they go! | 17:16 |
jrwren | in what state were they grown? | 17:16 |
greg-g | uhhhhh, dunno | 17:17 |
cmaloney | jrwren: Fun times | 17:17 |
greg-g | box is recycled (and pickup day was yesterday) | 17:17 |
jrwren | greg-g: i'll pretend they are MI peaches ;P | 17:17 |
greg-g | heh, thanks to ya'll then :P | 17:18 |
jrwren | I don't see a way I can parse '1 day ago 2 hours ago' in dateutils :p | 17:18 |
cmaloney | jrwren: datetime | 17:19 |
cmaloney | https://stackoverflow.com/questions/6871016/adding-5-days-to-a-date-in-python | 17:19 |
cmaloney | and timedelta | 17:19 |
jrwren | cmaloney: no no no... I want it to work like gnu date cmd line. e.g. `$ date -d ‘1 day ago 2 hours ago’` | 17:20 |
jrwren | you can run that on linux (not on bsd/mac) | 17:20 |
jrwren | err, well, those quotes aren't right, but if you fix them you can run it :) | 17:20 |
cmaloney | try this: | 17:20 |
cmaloney | exec("date -d '1 day ago 2 hours ago'") :-P | 17:21 |
jrwren | bwahahahahahaha | 17:22 |
jrwren | i would, but I am concerned aboud speed of http responses and so I will not fork. | 17:23 |
cmaloney | https://golang.org/pkg/time/#Time.AddDate | 17:23 |
jrwren | that doesn't help. | 17:23 |
cmaloney | Use that to get the day one day before | 17:23 |
jrwren | lets say I pass '1 day ago' as a query parameter, how do I get a date. | 17:23 |
jrwren | right, you are saying to write my own parser. I'll take your advice. | 17:24 |
cmaloney | Yeah, sadly I don't know why Go doesn't have a parser like that | 17:24 |
jrwren | most langs don't. | 17:24 |
jrwren | most call C strtotime :) | 17:24 |
jrwren | although strangely ruby's fancy pants parser seems original | 17:25 |
cmaloney | MOst of the time I'm not parsing a string for my "two days ago" foo. That's a config parameter | 17:25 |
cmaloney | And if I need to get really fancy-pants I use https://docs.python.org/2/library/calendar.html | 17:26 |
cmaloney | for stuff like first day of the week | 17:26 |
jrwren | it must have just been teh nature of atlas apis when I was at arbor. the "days ago" queries were VERY useful. | 17:26 |
cmaloney | https://dateparser.readthedocs.io/en/latest/ | 17:28 |
jrwren | oooh! that is the one. | 17:29 |
jrwren | omg, those deps though | 17:30 |
cmaloney | That's not too crazy. ;) | 17:31 |
cmaloney | pytz six | 17:31 |
cmaloney | https://pypi.python.org/pypi/ruamel.yaml <- this one I don't quite understand | 17:31 |
cmaloney | nor the added regex lib | 17:32 |
cmaloney | ah, for reading config files | 17:32 |
jrwren | i don't see wehre it is supporting some of that syntax. https://github.com/scrapinghub/dateparser/blob/master/dateparser/parser.py | 17:32 |
jrwren | oh... https://github.com/scrapinghub/dateparser/blob/master/dateparser/freshness_date_parser.py there it is. | 17:32 |
jrwren | well, i wasn't going to hand write the parser, but maybe I will. | 17:33 |
jrwren | i just ran longer than I've ever run in my life. It was also the first run in my 40s | 21:57 |
jrwren | Also the first run since my knee injury. I didn't even notice it, so I guess I laid off it too long | 21:57 |
_stink__ | jrwren++ | 22:29 |
rick_h | jrwren: <3 awesome | 22:41 |
brousch | jrwren: You want date time stuff in Go? | 22:51 |
jrwren | brousch: I want strtotime, yes. | 22:54 |
brousch | I remember our Gonads at work talking about doing that | 22:58 |
brousch | I assume that's what Go programmers are called | 22:58 |
jrwren | gophers. | 22:59 |
jrwren | brousch: have I told you how much I love go now? I like it a lot. :) | 22:59 |
_stink__ | brousch++ | 23:35 |
Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!