Quantcast
Channel: How to get milliseconds since Unix epoch? - Unix & Linux Stack Exchange
Browsing latest articles
Browse All 6 View Live

Answer by user232326 for How to get milliseconds since Unix epoch?

In bash 5+ there is a variable with micro-second granularity: $EPOCHREALTIME.So:$ echo "$(( ${EPOCHREALTIME//.} / 1000 ))"1568385422635Prints time since epoch (1/1/70) in miliseconds.Failing that, you...

View Article


Answer by javabeangrinder for How to get milliseconds since Unix epoch?

With the GNU or ast-open implementation of date (or busybox' if built with the FEATURE_DATE_NANO option enabled), I would use:$ date +%s%3Nwhich returns milliseconds since Unix epoch.

View Article


Answer by Stéphane Chazelas for How to get milliseconds since Unix epoch?

In case anyone is using other shells than bash, ksh93 and zsh have a floating point $SECONDS variable if you do a typeset -F SECONDS which can be handy to measure time with accuracy:$ typeset -F...

View Article

Answer by goldilocks for How to get milliseconds since Unix epoch?

date +%s.%N will give you, eg., 1364391019.877418748. The %N is thenumber of nanoseconds elapsed in the current second. Notice it is 9 digits,and by default date will pad this with zeros if it is less...

View Article

Answer by manatwork for How to get milliseconds since Unix epoch?

To avoid calculations to get the milliseconds, command line JavaScript interpreters may help:bash-4.2$ node -e 'console.log(new Date().getTime())' # node.js1364391220596bash-4.2$ js60 -e 'print(new...

View Article


How to get milliseconds since Unix epoch?

I want to do a bash script that measures the launch time of a browser for that I am using an html which gets the time-stamp on-load in milliseconds using JavaScript.In the shell script just before i...

View Article
Browsing latest articles
Browse All 6 View Live