On 2006-08-14 11:05, Julian Elischer <julian_at_elischer.org> wrote: >Dag-Erling Sm?rgrav wrote: >>Julian Elischer <julian_at_elischer.org> writes: >>>At various times I've wanted to add timestamps to logfiles as >>>they are generated.. >> >> while read line ; do echo $(date '+%Y-%m-%d %H:%M:%S') "$line" ; done > > while this is true, if you had read the rest of the thread you > would have seen the words "without running date for every > line". That's true, but a bit harsh. Julian, we have probably caused you an inordinate amount of trouble and wasted too much of your time already with this, so I understand why you would be frustrated about replies like the one from DES. I'm sorry if I have, by my replying to the thread, caused you some of the frustration (especially since I initially thought this was cool and a nice feature to have and changed my mind later). Please bear with this last message from me about modifying date(1), and then I'll shut up until this issue is resolved by people who know more than me about src/ stuff :-) > I even said that it could be done using shell if one WAS > willing to run date for each line. Yes. But that would be horribly inefficient. After a fair bit of thought, my reluctancy to agree that a patch for date(1) is in order is based on at least the following reasons: - Making such a change would be a diversion from what date(1) traditionally does. It's a new feature and it would probably be useful, but I have doubts about its usefulness as an inline part of date(1). - There are countless ways to do the same thing with a filter, some of which also have timestamp granularity far better than what date(1) can ever hope to provide (at least without adding custom strftime(3) format specifiers, which is a needless diversion from standards). For example, a Perl-based filter can use gettimeofday() and provide timestamps with sub-second accuracy. This is not (currently) possible with strftime(3), which is what date(1) is based on :( - Now that this thread has been spawned, people who want to do something like this can easily find several suggestions to satisfy their needs, without modifying date. Admittedly this is a very weak argument for *NOT* adding new features, but still a thought that raises a few doubts about the immediate usefulness of the feature. Just my $0.02 on the topic. If you still think it's a good thing to have and somebody(TM) comes up with a patch that doesn't cause people too many problems, feel free to ignore everything above :) Regards, GiorgosReceived on Mon Aug 14 2006 - 23:54:21 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:59 UTC