LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   where to change in linux code to convert dmesg uptime to UTC format(human readable) (https://www.linuxquestions.org/questions/linux-newbie-8/where-to-change-in-linux-code-to-convert-dmesg-uptime-to-utc-format-human-readable-4175501187/)

Ananda Bbau 04-10-2014 01:57 AM

where to change in linux code to convert dmesg uptime to UTC format(human readable)
 
Hi All,

I changed the line CONFIG_PRINTK_TIME=y in kernel-2.6.32-x86_64.config to get dmesg timestamp. I am getting the time stamp in the following:
[ 5.967800] mbr: 0x80 0x00 0x00 0x00 0x01 0x01 0x00 0x83 0x55 0xaa
[ 5.974417] sd 0:2:0:0: [sda] 285155328 512-byte logical blocks: (145 GB/135 GiB)
[ 5.982530] sd 0:2:0:0: [sda] Write Protect is off

I want to convert this uptime demsg to UTC format dmesg (Human readable format). For that where do i need to change in linux code. I dont want any script and all. I need to change in linux code and need to install the image in several servers.

Berhanie 04-10-2014 02:07 AM

doesn't this do it?
Code:

TZ=UTC dmesg -T

Ananda Bbau 04-10-2014 02:17 AM

Quote:

Originally Posted by Berhanie (Post 5149917)
doesn't this do it?
Code:

TZ=UTC dmesg -T

Hi Berhanie,

Where do i need to set this (path)?

Berhanie 04-10-2014 02:19 AM

this is the command. just type it into a terminal.

Ananda Bbau 04-10-2014 02:22 AM

Quote:

Originally Posted by Berhanie (Post 5149919)
this is the command. just type it into a terminal.

Ok.. Thanks for your kind information. But everytime i dont type this command in termainal. The server booting time itself , i need to see the dmesg time stamp in UTC format not in uptime.

fpmurphy 04-10-2014 02:24 AM

The "timestamp" you are seeing in every record is a monotonically increasing timestamp in microseconds (unsigned 64 bit integer) There is no code in the kernel to output it in a date format.

jpollard 04-10-2014 08:12 AM

Quote:

Originally Posted by fpmurphy (Post 5149924)
The "timestamp" you are seeing in every record is a monotonically increasing timestamp in microseconds (unsigned 64 bit integer) There is no code in the kernel to output it in a date format.

This is partly because during parts of the boot (device initialization) there is no date available yet.

syg00 04-10-2014 06:41 PM

That "time-stamp" is kernel active time since boot. It's a duration, not a date. And it has holes in it, although as pointed out, guaranteed to be increasing. Useful for the kernel (devs), maybe not the rest of us.


All times are GMT -5. The time now is 09:50 PM.