Aug-04-2017, 03:25 AM
last night i was trying to quickly recall what syscall i used in C on Linux to get the time with nanoseconds. i thought it was "clock"-something or "get_clock"-something. so i "cheated" and ran a command under the strace command to see the syscalls it does. i ran the date command with the "+%N" option to ensure it would get nanoseconds since this option would display (only) the nanoseconds. to my surprise, i could not find a "clock" syscall at all. for those of you running linux and doing cli, see if you can see what syscall is used to get the current time with microseconds.
strace date +%Y-%m-%dT%H:%M:%S.%N
strace date +%Y-%m-%dT%H:%M:%S.%N