I can hardly get "ts -r" to rewrite its own timestamps. Testcase: "ls / | ts | ts -r %H" With 0.34 and 0.39, no rewrite ever occurs. With 0.31, the rewrite does occur (so there likely is a regression), but then before each line of output I get an error like: Use of uninitialized value in localtime at /usr/bin/ts line 86, <> line 12.
Yann Dirson wrote: 0.39 works for me. I wonder if this could be a locale problem? So str2time (from Date::Parse) is failing, or ts has not managed to match the date stamp to feed to it.
Hi Joey, Sorry my tests were wrong when trying to discriminate the locale factor out: "ls / | env LC_ALL=C ts | ts -r %H" does work with 0.34 and 0.39. More specifically, it looks like "env LC_ALL=xxx sh -c 'ls / | ts | ts -r %H'" works for "C" and "en" locales, but at least not for french ones on those versions. Similarly on 0.31, the "uninitialized" do not appear for "C", although it appears for "en".
Yann Dirson wrote: Date::Parse does not support localized dates. But I do not get uninitialized values running ts -r on input like: avril 27 15:08:14 bin/ etc/ lib/ mnt/ root/ srv/ usr/ avril 27 15:08:14 boot/ home/ lost+found/ opt/ sbin/
Le Tue, 27 Apr 2010 15:10:20 -0400, Joey Hess <joeyh@debian.org> a écrit : Ah, that's unfortunate :) I don't get them with current versions, only with 0.31.
Le Wed, 28 Apr 2010 10:54:54 +0200, Yann Dirson <dirson@bertin.fr> a écrit : I wanted to add, a note about that in the docs may be good. Also, I infer that in 0.31 there was another mechanism in use, which supported localized timestamps (strptime ?). Maybe it can be reintroduced as a fallback when Date::Parse fails ? Best regards,
Yann Dirson wrote: No, code has not changed since 0.31.
Le Wed, 28 Apr 2010 11:47:02 -0400, Joey Hess <joeyh@debian.org> a écrit : My bad, it did not really work with 0.31 - reformatting to %H%M%S always yields "010000" regardless of actual timestamp. That may be related to the "uninitialized value" exceptions. Indeed 0.31 also rewrite file dates in a "ls -l|ts" stream, which is also quite unexpected. So 0.39 is actually better than 0.31 :) What about the idea of falling back to strptime ?
Yann Dirson wrote: It's a good idea, but I have not been able to find a perl interface to strptime yet, oddly.
Le Thu, 29 Apr 2010 12:27:51 -0400, Joey Hess <joeyh@debian.org> a écrit : Maybe not as standard, but google quickly reveals a POSIX::strptime on CPAN, and apt-cache search shows libtime-piece-perl, which provides a bit more, and libdatetime-format-strptime-perl, which "implements most of strptime" (sic). Not sure what to use, my naive choice would be for the one that is not yet packaged :) Best regards,