til

Today I Learned: collection of notes, tips and tricks and stuff I learn from day to day working with computers and technology as an open source contributor and product manager

View project on GitHub

Get nanoseconds as part of epoch

To get the nanoseconds as part of the epoch time, you can use the following command:

date +%s%N
1720593252N

This does however not work on macOS. On macOS, you can use the following command:

gdate +%s%N
1720593307223485000

Do note that it is always represented as zeroes.

The gdate command is part of the coreutils package. You can install it using Homebrew:

brew install coreutils

Resources and References