summaryrefslogtreecommitdiff
path: root/date.c
AgeCommit message (Collapse)AuthorFilesLines
2005-10-14Unlocalized isspace and friendsLibravatar Linus Torvalds1-1/+0
Do our own ctype.h, just to get the sane semantics: we want locale-independence, _and_ we want the right signed behaviour. Plus we only use a very small subset of ctype.h anyway (isspace, isalpha, isdigit and isalnum). Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-22[PATCH] Fix strange timezone handlingLibravatar Linus Torvalds1-10/+14
We generate the ASCII representation of our internal date representation ("seconds since 1970, UTC + timezone information") in two different places. One of them uses the stupid and obvious way to make sure that it gets the sexagecimal representation right for negative timezones even if they might not be exact hours, and the other one depends on the modulus operator always matching the sign of argument. Hey, the clever one works. And C90 even specifies that behaviour. But I had to think about it for a while when I was re-visiting this area, and even if I didn't have to, it's kind of strange to have two different ways to print out the same data format. So use a common helper for this. And select the stupid and straighforward way. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-20[PATCH] Return proper error valud from "parse_date()"Libravatar Linus Torvalds1-3/+3
Right now we don't return any error value at all from parse_date(), and if we can't parse it, we just silently leave the result buffer unchanged. That's fine for the current user, which will always default to the current date, but it's a crappy interface, and we might well be better off with an error message rather than just the default date. So let's change the thing to return a negative value if an error occurs, and the length of the result otherwise (snprintf behaviour: if the buffer is too small, it returns how big it _would_ have been). [ I started looking at this in case we could support date-based revision names. Looks ugly. Would have to parse relative dates.. ] Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-07-12parse_date(): allow const date stringLibravatar Linus Torvalds1-4/+4
This is part of breaking up the tag ID patch by Eric Biederman.
2005-06-25[PATCH] fix date parsing for GIT raw commit timestamp format.Libravatar Junio C Hamano1-5/+9
Usually all of the match_xxx routines in date.c fill tm structure assuming that the parsed string talks about local time, and parse_date routine compensates for it by adjusting the value with tz offset parsed out separately. However, this logic does not work well when we feed GIT raw commit timestamp to it, because what match_digits gets is already in GMT. A good testcase is: $ make test-date $ ./test-date 'Fri Jun 24 16:55:27 2005 -0700' '1119657327 -0700' These two timestamps represent the same time, but the second one without the fix this commit introduces gives you 7 hours off. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-22Include file cleanups..Libravatar Linus Torvalds1-3/+0
Add <limits.h> to the include files handled by "cache.h", and remove extraneous #include directives from various .c files. The rule is that "cache.h" gets all the basic stuff, so that we'll have as few system dependencies as possible.
2005-05-20sparse cleanupLibravatar Linus Torvalds1-0/+2
Fix various things that sparse complains about: - use NULL instead of 0 - make sure we declare everything properly, or mark it static - use proper function declarations ("fn(void)" instead of "fn()") Sparse is always right.
2005-05-18[PATCH] fix show_date() for positive timezonesLibravatar Nicolas Pitre1-2/+2
Signed-off-by: Nicolas Pitre <nico@cam.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-06date.c: add "show_date()" function.Libravatar Linus Torvalds1-0/+28
Kind of like ctime(), but not as broken.
2005-05-01date handling: handle "AM"/"PM" on timeLibravatar Linus Torvalds1-8/+22
And be a bitmore careful about matching: if we don't recognize a word or a number, we skip the whole thing, rather than trying the next character in that word/number. Finally: since ctime() adds the final '\n', don't add another one in test-date.
2005-05-01date.c: allow even more varied time formatsLibravatar Linus Torvalds1-54/+152
(and some added checks for truly non-sensical stuff)
2005-04-30date.c: fix printout of timezone offsets that aren't exact hoursLibravatar Linus Torvalds1-2/+8
We'd get the sign wrong for the minutes part of a negative offset.
2005-04-30date.c: only use the TZ names if we don't have anything better.Libravatar Linus Torvalds1-1/+5
Also, add EEST (hey, it's Finland).
2005-04-30date.c: split up dst information in the timezone tableLibravatar Linus Torvalds1-45/+51
This still doesn't actually really _use_ it properly, nor make any distinction between different DST rules, but at least we could (if we wanted to) fake it a bit better. Right now the code actually still says "it's always summer". I'm from Finland, I don't like winter.
2005-04-30date.c: fix parsing of dates in mm/dd/yy formatLibravatar Linus Torvalds1-1/+3
We looked at the year one character too early, and we didn't accept a two-character year date after 2000.
2005-04-30date.c: use the local timezone if none specifiedLibravatar Linus Torvalds1-2/+7
2005-04-30Make the date parsing accept pretty much any random crap.Libravatar Linus Torvalds1-106/+215
This date parser turns line-noise into a date. Cool.
2005-04-30[PATCH] Do date parsing by hand...Libravatar Edgar Toernig1-0/+184
...since everything out there is either strange (libc mktime has issues with timezones) or introduces unnecessary dependencies for people (libcurl). This goes back to the old date parsing, but moves it out into a file of its own, and does the "struct tm" to "seconds since epoch" handling by hand. I grepped through the tz-database and it seems there's one "country" left that has non-60-minute DST: Lord Howe Island. All others dropped that before 1970.