Hi, > > On Tue, Jun 10, 2008 at 5:10 PM, Brandon Casey <casey@xxxxxxxxxxxxxxx> wrote: > > > Take a look at match_multi_number in date.c > > > European ordering is preferred when the separator is '.' > > > > Ok, then I'll use . in the future, that's nice :). > > Well, there are safer ways to give the date. > > If you do it in strict rfc822 format, you'll never have any confusion > what-so-ever. The "approxidate()" thing tries to parse any random input, > but it *is* meant to be excessively liberal. Today I've been playing around with approxidate(), too, and I think I found some bug in date parsing. I let copy&paste speak... Correct: $ ./test-date "2008-07-01 23:59:59 +0200" 2008-07-01 23:59:59 +0200 -> 1214949599 +0200 -> Tue Jul 1 23:59:59 2008 2008-07-01 23:59:59 +0200 -> Tue Jul 1 23:59:59 2008 And even: $ ./test-date "2008-07-01 24:00:00 +0200" 2008-07-01 24:00:00 +0200 -> 1214949600 +0200 -> Wed Jul 2 00:00:00 2008 2008-07-01 24:00:00 +0200 -> Wed Jul 2 00:00:00 2008 But then there's a jump in time: $ ./test-date "2008-07-02 00:00:00 +0200" 2008-07-02 00:00:00 +0200 -> 1202335200 +0200 -> Wed Feb 6 23:00:00 2008 2008-07-02 00:00:00 +0200 -> Wed Feb 6 23:00:00 2008 $ ./test-date "2008-07-02 01:00:00 +0200" 2008-07-02 01:00:00 +0200 -> 1202338800 +0200 -> Thu Feb 7 00:00:00 2008 2008-07-02 01:00:00 +0200 -> Thu Feb 7 00:00:00 2008 If we let test-date just print the timestamp... diff --git a/test-date.c b/test-date.c index 62e8f23..18d53c1 100644 --- a/test-date.c +++ b/test-date.c @@ -11,10 +11,10 @@ int main(int argc, char **argv) memcpy(result, "bad", 4); parse_date(argv[i], result, sizeof(result)); t = strtoul(result, NULL, 0); - printf("%s -> %s -> %s", argv[i], result, ctime(&t)); + printf("%s -> %lu\n", argv[i], t); t = approxidate(argv[i]); - printf("%s -> %s\n", argv[i], ctime(&t)); + printf("%s -> %lu\n", argv[i], t); } return 0; } -- -- -- -- ... then we get: $ ./test-date "2008-07-01 23:59:59 +0200" 2008-07-01 23:59:59 +0200 -> 1214949599 2008-07-01 23:59:59 +0200 -> 1214949599 $ ./test-date "2008-07-02 00:00:00 +0200" 2008-07-02 00:00:00 +0200 -> 1202335200 2008-07-02 00:00:00 +0200 -> 1202335200 Also, with another timezone, we get: $ ./test-date "2008-07-01 23:59:59 +0000" 2008-07-01 23:59:59 +0000 -> 1214956799 2008-07-01 23:59:59 +0000 -> 1214956799 $ ./test-date "2008-07-02 00:00:00 +0000" 2008-07-02 00:00:00 +0000 -> 1202342400 2008-07-02 00:00:00 +0000 -> 1202342400 Is something wrong in my format or is there a bug? Providing timestamps works, of course ;-) Regards, Stephan -- Stephan Beyer <s-beyer@xxxxxxx>, PGP 0x6EDDD207FCC5040F -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html