Timeline for How to get milliseconds since Unix epoch?
Current License: CC BY-SA 4.0
20 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Nov 16, 2022 at 17:17 | comment | added | goldilocks | You could use backticks on the date call but not the outer part. This is really a matter of personal preference; see some of the other answers to that question. There's no much point in presenting both versions here, and I prefer the $() syntax. | |
| Nov 14, 2022 at 22:46 | comment | added | JGFMK | Can't you simplify this with backticks..unix.stackexchange.com/questions/27428/… | |
| Nov 22, 2019 at 13:44 | history | edited | goldilocks | CC BY-SA 4.0 | deleted 54 characters in body |
| Nov 22, 2019 at 12:33 | comment | added | goldilocks | @Hitechcomputergeek >_< Good point, edited that in! | |
| Nov 22, 2019 at 12:31 | history | edited | goldilocks | CC BY-SA 4.0 | added 179 characters in body |
| Nov 21, 2019 at 22:15 | comment | added | Hitechcomputergeek | Why not just echo $(( $(date '+%s%N') / 1000000))? | |
| Jan 29, 2015 at 11:20 | comment | added | orkoden | %N isn't available in BSD and OS X. | |
| Mar 29, 2013 at 9:54 | history | edited | goldilocks | CC BY-SA 3.0 | fleshed out note about padding. |
| S Mar 27, 2013 at 19:54 | history | suggested | Alois Mahdal | CC BY-SA 3.0 | fixed 10%-case bug by turning off zero-padding; 6 char edit limit tricking |
| Mar 27, 2013 at 19:09 | comment | added | Alois Mahdal | Fixed by turning off zero padding as noted in date(1) | |
| Mar 27, 2013 at 19:08 | review | Suggested edits | |||
| S Mar 27, 2013 at 19:54 | |||||
| Mar 27, 2013 at 18:56 | comment | added | Alois Mahdal | This fails in at least 10% of cases: when first digit of %N is zero, the number is interpreted as octal, which causes bash throw error (unless rest of digits are lower than 7, in which case the failure is hidden!) | |
| Mar 27, 2013 at 16:45 | history | edited | goldilocks | CC BY-SA 3.0 | added 302 characters in body |
| Mar 27, 2013 at 16:41 | comment | added | goldilocks | @StephaneChazelas Ouch, yeah that is a pitfall, will edit. Thx. | |
| Mar 27, 2013 at 16:24 | comment | added | Stéphane Chazelas | Note that in between the time you run the first date and the second date, several million nanoseconds may have passed and it might not even be the same second. Best to do $(($(date +'%s * 1000 + %N / 1000000'))). That still doesn't make much sense, but would be more reliable. | |
| Mar 27, 2013 at 13:55 | history | edited | manatwork | CC BY-SA 3.0 | minor typo in the date format parameter syntax |
| Mar 27, 2013 at 13:38 | vote | accept | Eduard Florinescu | ||
| Mar 27, 2013 at 13:36 | history | edited | goldilocks | CC BY-SA 3.0 | added 95 characters in body |
| Mar 27, 2013 at 13:36 | history | edited | manatwork | CC BY-SA 3.0 | minor typo in the date format parameter syntax |
| Mar 27, 2013 at 13:35 | history | answered | goldilocks | CC BY-SA 3.0 |