Timestamp formatting in Linux kernel

2020-07-27 03:13发布

问题:

Is there a way to print formatted timestamps within the linux kernel? I have a proc file that displays a series of time related events, and I want to format the timestamps as date/time, honoring timezone, etc.

I have a struct timespec obtained via getnstimeofday(). I want to print the absolute date & time in the current time zone when I generate the content of the proc file.