UTC and localtime

Hi Guys,
I’m running openSuSE 12.1 and my local time and UTC are reversed, That is when I enter <hwclock --localtime> it displays GMT, and when I enter <hwclock --utc> it displays my local time. My time zone is America/New_York, and this is set correctly. I set my desktop clock to my local time and my /etc/sysconfig/clock file shows the directive <HWCLOCK ="–localtime>. I should mention that I am running this os out of VirtualBox. However, my host os, Trisquel 5.5, has the same problem, so the fault is probably not with VirtualBox. Does anyone have any ideas on how to fix this problem. I’ve tried everything in my CompTIA Linux+ textbook to no avail. Thanks for your help.
Mike

On Thu, 31 May 2012 19:36:02 +0000, murphy19804 wrote:

> However, my host os, Trisquel 5.5, has the same problem, so the fault is
> probably not with VirtualBox.

I would fix it in the host. The guest is probably picking the issue up
from the host, so start with the host.

Does the host dual-boot Windows? One common issue is that Windows stores
local time in the HW clock, and Linux prefers UTC.

Jim


Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

On 2012-05-31 21:36, murphy19804 wrote:
>
> Hi Guys,
> I’m running openSuSE 12.1 and my local time and UTC are reversed, That
> is when I enter <hwclock --localtime> it displays GMT, and when I enter
> <hwclock --utc> it displays my local time. My time zone is
> America/New_York, and this is set correctly. I set my desktop clock to
> my local time and my /etc/sysconfig/clock file shows the directive
> <HWCLOCK ="–localtime>.

Run “hwclock --debug”, then “date” and post commands and output here, using
code tags:

Posting in Code
Tags - A Guide

> I should mention that I am running this os out
> of VirtualBox. However, my host os, Trisquel 5.5, has the same problem,
> so the fault is probably not with VirtualBox.

I don’t know what is “Trisquel”, but assuming it is Linux do the same as above.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

Thank you for your reply. I tried fixing it in the host, but I had no more luck than in the guest. Also, I don’t dual-boot, so there should not be a local time vs UTC conflict. However, this machine used to run windows, and, although I did a clean install to Linux is there any possibility of a hold over from the way windows handles the hwclock? Is that even possible? I wouldn’t think so, but then you never know. Anyway, thanks again for your suggestion. Mike

Thank you for your reply.
Here is the code you requested.
[CODEroot@mutts-desktop:~# hwclock --debug
hwclock from util-linux 2.19.1
Using /dev interface to clock.
Last drift adjustment done at 1338412290 seconds after 1969
Last calibration done at 1338412290 seconds after 1969
Hardware clock is on local time
Assuming hardware clock is kept in local time.
Waiting for clock tick…
…got clock tick
Time read from Hardware Clock: 2012/06/01 13:40:25
Hw clock time : 2012/06/01 13:40:25 = 1338572425 seconds since 1969
Fri 01 Jun 2012 01:40:25 PM EDT -0.244358 seconds
root@mutts-desktop:~# date
Fri Jun 1 09:40:53 EDT 2012
root@mutts-desktop:~#
]


Thank you for your help.
Mike

On Fri, 01 Jun 2012 13:36:02 +0000, murphy19804 wrote:

> I tried fixing it in the host, but I had no more luck than in the guest.
> Also, I don’t dual-boot, so there should not be a local time vs UTC
> conflict. However, this machine used to run windows, and, although I did
> a clean install to Linux is there any possibility of a hold over from
> the way windows handles the hwclock? Is that even possible? I wouldn’t
> think so, but then you never know. Anyway,
> thanks again for your suggestion. Mike

Try getting the time in the host set properly and then execute:

hwclock --systohc

That should set the HW clock to the system setting.

You can also run hwclock on its own to see what time the clock says it is.

Jim


Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

On 2012-06-01 15:46, murphy19804 wrote:

>> I don’t know what is “Trisquel”, but assuming it is Linux do the same
>> as above.

This one you haven’t answered.

> Thank you for your reply.
> Here is the code you requested.
>
> Code:
> --------------------
> root@mutts-desktop:~# hwclock --debug
> hwclock from util-linux 2.19.1
> Using /dev interface to clock.
> Last drift adjustment done at 1338412290 seconds after 1969
> Last calibration done at 1338412290 seconds after 1969
> Hardware clock is on local time
> Assuming hardware clock is kept in local time.
> Waiting for clock tick…
> …got clock tick
> Time read from Hardware Clock: 2012/06/01 13:40:25
> Hw clock time : 2012/06/01 13:40:25 = 1338572425 seconds since 1969
> Fri 01 Jun 2012 01:40:25 PM EDT -0.244358 seconds
> root@mutts-desktop:~# date
> Fri Jun 1 09:40:53 EDT 2012
> root@mutts-desktop:~#
>
> --------------------

Ok, your hardware clock is not set, and is running local time. You should
set it to UTC, as you are not double-booting, and then sync it (after
ensuring that the computer time as shown by “date” is correct).

The command “hwclock --systohc” will copy the computer time to the hardware
clock.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

Thank you. I seem to be all squared away now.
Mike

Trisquel is Linux and the code I copied above is from it. openSuSE 12.1 generates the same code. However, I took your suggestions and am all squared away now. Thank you.
Mike

Thank you for your help. I’m all squared away. now.
Mike

Trisquel is Linux and the code I copied above was generated by Trisquel. I followed the same procedure in openSuse 12 and got identical code, so I only posted the one. Anyway, thank you for your help. Things are working fine, now.
Mike

On 2012-06-01 21:16, murphy19804 wrote:
>
> Trisquel is Linux and the code I copied above is from it. openSuSE 12.1
> generates the same code. However, I took your suggestions and am all
> squared away now. Thank you.

Ok :slight_smile:


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

On Fri, 01 Jun 2012 19:06:03 +0000, murphy19804 wrote:

> Thank you. I seem to be all squared away now.

Great news, thanks for reporting back. :slight_smile:

Jim


Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C