Subject | Hash | Author | Date (UTC) |
---|---|---|---|
ts improvements | decdf6ec49194e5c02fa42c3a235bdefee224175 | Joey Hess | 2008-04-13 00:37:28 |
fix mode of new file renamed from temp file | c525af9d17aacb226d72495d1bd401ce001b03f6 | Joey Hess | 2008-04-11 23:11:33 |
minor changes | b6d635bc28bf7d94201bcd167905cebc48abf7cb | Joey Hess | 2008-04-11 23:03:50 |
honor TMPDIR | f69844b98d71598fbf9ef3f4da137b16eff1621e | Joey Hess | 2008-04-11 22:55:10 |
optimize tempfile copying | 6f31909ff74c064ea0b5126219b3e8f7b8826bee | Joey Hess | 2008-04-11 22:34:34 |
more fixes to tempfile writeback | a580bbd17850753746d6d1a2b65817edaf4485c9 | Joey Hess | 2008-04-11 22:27:40 |
set umask before calling mkstemp | 0595609018095dabd5d1a56cf03ddcc008a9e928 | Joey Hess | 2008-04-11 21:47:28 |
update physmem copyright | 30746c4357c0ac6110ca7e2a279ce9e82e879581 | Joey Hess | 2008-04-11 21:44:19 |
fix two bugs writing the output file | 6fa7d9907e7211f06656b296940aaca1d6b4d1df | Joey Hess | 2008-04-11 21:42:38 |
move code into a function | dcb580b3998a19b112004f23298490a34af59fc8 | Joey Hess | 2008-04-11 20:15:29 |
fix edge cases | ee4e74dd6a20706f29ef30a2613a1977f6f325fa | Joey Hess | 2008-04-11 20:10:18 |
reorder defines | 0bf88ea14cda6e6e57e97356862628ae49269c8a | Joey Hess | 2008-04-11 19:54:30 |
set up signal handlers before creating temp file | 0ff304e2ca860e51e75bbfc08290e364e94cb32e | Joey Hess | 2008-04-11 19:53:38 |
another round of whitespace fixes | c391b00d2837d1571ac1d361551378adf19ae83f | Joey Hess | 2008-04-11 19:50:47 |
remove debug | 919ce1f7b6d80dfdc3c613f898215962985f9c66 | Brock Noland | 2008-04-11 19:22:39 |
sponge fixes | 42c5c5a799502743307b392bf9e7c0205ef85ace | Brock Noland | 2008-04-11 18:16:09 |
better usage message | 73327f97a62619cb8b1a0bc03e5e105839449f9a | Joey Hess | 2008-04-11 04:36:46 |
update changelog | 79c6fe1242a4747c4adbcc9030d2cadc61c1028a | Joey Hess | 2008-04-11 04:35:24 |
convert to new format | 2c8be0fef4c247de0e5511abdbda25e3611b9f8c | Joey Hess | 2008-04-11 04:32:31 |
first pass thru the code | b2174f2df2410bf82fe646bcedd333ddbd7dbf66 | Joey Hess | 2008-04-11 03:49:31 |
File | Lines added | Lines deleted |
---|---|---|
debian/changelog | 3 | 0 |
ts | 8 | 2 |
File debian/changelog changed (mode: 100644) (index d9fdf39..ffa7f5b) | |||
... | ... | moreutils (0.29) UNRELEASED; urgency=low | |
6 | 6 | rather than write(). | rather than write(). |
7 | 7 | * sponge: Handle large data sizes by using a temp file rather than by | * sponge: Handle large data sizes by using a temp file rather than by |
8 | 8 | consuming arbitrary amounts of memory. Patch by Brock Noland. | consuming arbitrary amounts of memory. Patch by Brock Noland. |
9 | * ts: Allow both -r and a format to be specified, to parse dates and output | ||
10 | in a specified format. | ||
11 | * ts: Fix bug in timezone regexp. | ||
9 | 12 | ||
10 | 13 | -- Joey Hess <joeyh@debian.org> Thu, 20 Mar 2008 12:56:42 -0400 | -- Joey Hess <joeyh@debian.org> Thu, 20 Mar 2008 12:56:42 -0400 |
11 | 14 |
File ts changed (mode: 100755) (index d1cbb16..d8d8719) | |||
... | ... | the input to relative times, such as "15m5s ago". Many common timestamp | |
20 | 20 | formats are supported. Note that the Time::Duration and Date::Parse perl | formats are supported. Note that the Time::Duration and Date::Parse perl |
21 | 21 | modules are required for this mode to work. | modules are required for this mode to work. |
22 | 22 | ||
23 | If both -r and a format is passed, the format existing timestamps are | ||
24 | converted to the specified format. | ||
25 | |||
23 | 26 | =head1 ENVIRONMENT | =head1 ENVIRONMENT |
24 | 27 | ||
25 | 28 | The standard TZ environment variable controls what time zone dates | The standard TZ environment variable controls what time zone dates |
... | ... | if ($rel) { | |
51 | 54 | die $@ if $@; | die $@ if $@; |
52 | 55 | } | } |
53 | 56 | ||
57 | my $use_format=@ARGV; | ||
54 | 58 | my $format="%b %d %H:%M:%S"; | my $format="%b %d %H:%M:%S"; |
55 | 59 | $format=shift if @ARGV; | $format=shift if @ARGV; |
56 | 60 | ||
... | ... | while (<>) { | |
73 | 77 | (?:\w\w\w,?\s+)? # (optional Day) | (?:\w\w\w,?\s+)? # (optional Day) |
74 | 78 | \d+\s+\w\w\w\s+\d\d+\s+\d\d:\d\d:\d\d | \d+\s+\w\w\w\s+\d\d+\s+\d\d:\d\d:\d\d |
75 | 79 | # 16 Jun 94 07:29:35 | # 16 Jun 94 07:29:35 |
76 | (?:\s+\w\w\w|\s+-\d\d\d\d)? | ||
80 | (?:\s+\w\w\w|\s[+-]\d\d\d\d)? | ||
77 | 81 | # (optional timezone) | # (optional timezone) |
78 | 82 | | | | |
79 | 83 | \w\w\w\s+\w\w\w\s+\d\d\s+\d\d:\d\d | \w\w\w\s+\w\w\w\s+\d\d\s+\d\d:\d\d |
80 | 84 | # lastlog format | # lastlog format |
81 | 85 | )\b | )\b |
82 | 86 | }{ | }{ |
83 | concise(ago(time - str2time($1), 2)) | ||
87 | $use_format | ||
88 | ? strftime($format, localtime(str2time($1))) | ||
89 | : concise(ago(time - str2time($1), 2)) | ||
84 | 90 | }exg; | }exg; |
85 | 91 | ||
86 | 92 | print $_; | print $_; |