Project

General

Profile

Feature #3938

Would like %N support in date(1)

Added by Robert Mustacchi over 7 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Category:
cmd - userland programs
Start date:
2013-07-28
Due date:
% Done:

0%

Estimated time:
Difficulty:
Bite-size
Tags:
Gerrit CR:

Description

From the Joyent bug report:

In Linux date(1) supports %N which outputs the nanoseconds of the current time:

joshw@bh1-www0:~$ date +%s.%N
1347312240.211019753
joshw@bh1-www0:~$ date +%s.%N
1347312241.420862398
joshw@bh1-www0:~$ date +%s.%N
1347312242.260851519
joshw@bh1-www0:~$ date +%s.%N
1347312242.990919297
joshw@bh1-www0:~$ date +%s.%N
1347312243.660914691
joshw@bh1-www0:~$ date +%s.%N
1347312244.300927523
joshw@bh1-www0:~$

which allows for nanosecond. In my use-case I just need something smaller than 1 second (ms would be great) that's available from bash. I have a shell script that does many things in one second and I just want to keep track internally of the time that each one of the steps takes. The steps themselves involve more than one command so using time(1) doesn't work so well for me.


Related issues

Related to illumos gate - Feature #1601: date command should support +%NResolvedKeith Wesolowski2011-10-05

Actions
#1

Updated by Alexander Eremin over 7 years ago

This is duplicate for #1601

#2

Updated by Keith Wesolowski over 7 years ago

  • Status changed from New to Closed
  • % Done changed from 90 to 0
  • Difficulty changed from Medium to Bite-size

Also available in: Atom PDF