Live data from Hacker News

Show HN: now.sh

github.com

11–20 of 45 posts

Re: Show HN: now.sh

#12

I'm not sure I really see a point in this. How are you going to forget the server's time zone when it's listed in the timestamps? It doesn't really make sense.

It's for the cases when you are in a different timezone than the server. When the log says "03/Mar/2013 09:24:13 -0800" and it's 13:50 where I am, it takes me a while to understand how old that line is.

Re: Show HN: now.sh

#13
I have the current time printed in my prompt, which means I can easily see how long commands took to run, eg:

    [start time] $ ./run_long_script
    [ end time ] $
My actual prompt looks like:

    [09:36] bmd-mba|bmd ~
    $ whoami
    bmd
    [09:36] bmd-mba|bmd ~
    $
Details in https://github.com/coderholic/config/blob/master/.bash_profi...

Re: Show HN: now.sh

#14

I'm not sure I really see a point in this. How are you going to forget the server's time zone when it's listed in the timestamps? It doesn't really make sense.

It's for the cases when you are in a different timezone than the server. When the log says "03/Mar/2013 09:24:13 -0800" and it's 13:50 where I am, it takes me a while to understand how old that line is.

Right, the server says its timezone is -0800. You don't know what timezone you are currently in?

Re: Show HN: now.sh

#15

I have the current time printed in my prompt, which means I can easily see how long commands took to run, eg: [start time] $ ./run_long_script [ end time ] $ My actual prompt looks like: [09:36] bmd-mba|bmd ~ $ whoami bmd [09:36] bmd-mba|bmd ~ $ Details in https://github.com/coderholic/config/blob/master/.bash_profi...

Is there a way to do this so the timestamp includes seconds? Thanks.

Re: Show HN: now.sh

#16

I have the current time printed in my prompt, which means I can easily see how long commands took to run, eg: [start time] $ ./run_long_script [ end time ] $ My actual prompt looks like: [09:36] bmd-mba|bmd ~ $ whoami bmd [09:36] bmd-mba|bmd ~ $ Details in https://github.com/coderholic/config/blob/master/.bash_profi...

Actually with that setup (which is a bit like mine) you can see how long it took from the finishing time of the last command you executed (when your PS1 was redisplayed) to the finishing of the command you just executed.

Re: Show HN: now.sh

#17

I have the current time printed in my prompt, which means I can easily see how long commands took to run, eg: [start time] $ ./run_long_script [ end time ] $ My actual prompt looks like: [09:36] bmd-mba|bmd ~ $ whoami bmd [09:36] bmd-mba|bmd ~ $ Details in https://github.com/coderholic/config/blob/master/.bash_profi...

Is there a way to do this so the timestamp includes seconds? Thanks.

By default "\t" in your PS1 will display the time the same way `date +%H:%M:%S` does (which includes seconds).

Re: Show HN: now.sh

#18
Speaking of date/time stuff, is there anything that would convert to the current time zone?

e.g. echo "03/Mar/2013 01:16:52 +0000" | mytz => 02/Mar/2013 17:16:52 -0800

Re: Show HN: now.sh

#19

Earlier quoted context omitted.

It's for the cases when you are in a different timezone than the server. When the log says "03/Mar/2013 09:24:13 -0800" and it's 13:50 where I am, it takes me a while to understand how old that line is.

Right, the server says its timezone is -0800. You don't know what timezone you are currently in?

I know it's different, meaning that I have to do some basic arithmetics to get the log line age. It also requires me to roll my precious eyes to look at the local time in a system tray. It's just all too tedious.

Re: Show HN: now.sh

#20
post #9

Another alternative is 'ts' which is part of joey hess's awesome collection of unix tools, moreutils.[1] I did not find out about ts until too late so I am still in the habit of using tai64n from djb's daemontools, which adds a tai64 timestamp to every file[2] and then tai64nlocal[3] in order to convert the timestamps to something useful to humans. If you don't know about moreutils check out the collection. I don't k…

If I read ts source right, it merely prepends the current time to every line it echoes from stdin to stdout. now is different. It re-prints current time once a second while waiting for the input. You basically get the running clock at the last line of output.

Oops. You are correct. Thanks for pointing that out. I have to say that now that I understand what it does I have no idea about the use case.
Post reply on HN