Hi PERLANCAR,
On Thu Aug 06 00:41:53 2015, PERLANCAR wrote:
Show quoted text> Hi Shlomi,
>
> Thanks for your response.
>
> > furthermore, it will add complexity to the program, may hurt
> > performance, may require adding more dependencies,
>
> About performance: I'm not arguing that formatting Unix timestamp into
> ISO8601 or RFC822 format adds some overhead than just printing the
> timestamp. But this overhead is in the order of a couple of
> microseconds and should not matter for a lot of cases. And, for cases
> in which this matters, one can just use the raw Unix timestamp format.
Well, it may also add overhead of conditionals/etc. to choose between the options.
Show quoted text>
> As for dependencies, one would only need the POSIX module (core since
> 5.0).
Like Slaven noted - strftime() does not handle fractional seconds.
Show quoted text>
> > and it stands
> > against the UNIX philosophy that a command line tool should perform
> > one task and perform it well.
>
> True, but the tricky part is defining what constitutes as "one task"
> ;-)
In general, a single task in my opinion, is one which cannot be done by chaining the tool to another processing tool, which in this case is possible.
Show quoted text> If the task is to be "print (or prepend) timestamp to input lines"
> (as the name "timestamper" would suggest, since the name is not "unix-
> timestamper"), then providing several date formats is not
> unreasonable.
>
Well, you can always do it as a separate stage and this way keep "timestamper" free of unnecessary features , which I'll have to maintain for back-compat until infinity. If you don't like it, then either write a post-processor or fork App-Timestamper or whatever.
And I might as well call it "gnu-linux-unix-perl-timestamper". ;-)