0

I'm newbie to Linux kernel.

Is there a way to print from within kernel time stamp, which respects timezone and DST, as done in user space (e.g. by localtime(3))?

I suspect TZ and DST live in user space land only and not relevant in context of kernel space, but I'm required to print user friendly message from kernel module.

Thanks

1 Answer 1

1

You are correct in that TZ and DST live only in userspace. The kernel never knows what time zone it is. If you really need to do this, you will need to have a userspace helper upload timezone offsets to kernelspace - remember to deal with daylight savings time properly here! Alternately have a userspace tool postprocess kernel messages (which would be in UTC) and convert them to local time.

Sign up to request clarification or add additional context in comments.

1 Comment

Looks like dmesg uses the same trick - it reads /proc/kmesg and interprets UTC time to local time.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.