Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: MSQL Unable to set the UTC timezone permamently

  1. #11

    Default Re: MSQL Unable to set the UTC timezone permamently

    @wolfi323

    You are a legend.
    Thank you very much.
    Thank you to all others you have tried to help, really appreciate it ...

    So the trick is at a certain location of the file. Actually I was placing it at the end, the way I did it in my windows machine, so certainly this is not the same

    I have placed
    Code:
    default-time-zone = UTC
    in the [mysqld] section of the my.cnf file.

    its all working

  2. #12

    Default Re: MSQL Unable to set the UTC timezone permamently

    Quote Originally Posted by harbir_linuxuser View Post
    So the trick is at a certain location of the file. Actually I was placing it at the end, the way I did it in my windows machine, so certainly this is not the same
    Probably on your windows machine the "[mysqld]" section actually is at the end of the file. As it is a standard configuration file, it can of course differ between installations. And openSUSE's default file may look different than the default file on a windows installation.

    I really doubt that the windows version of MySQL would behave differently in regard to parsing the config file than the Linux version.

    Quote Originally Posted by gogalthorp View Post
    Well it shouldn't but I have seen the guest affected by the Host settings. I run XP as quest and at one point the VM wanted to reset the guest because I was running UTC on the host and Win XP wanted this to be local time. It was a VM problems and have not seen it for a while but feel all basic time functions should always be set to UTC to avoid these odd time normalization problems.
    Well, yes, to make sure the system clock is correct.
    Still I don't see the connection to MySQL running in the VM.

    And again, neither the VM nor MySQL (regardless whether it is running in the guest or the host) should care what the host's _hardware_ clock is set to.
    They don't read the hardware clock.

    VirtualBox has an explicit setting whether the guest's "hardware" clock should be in UTC or local time though. This is needed as it just takes that time from the host's system clock, it doesn't really store the guest's hardware clock's time.

    Even Windows will use UTC as a base now a days though you do have to beat it over the head sometimes
    Yes. AFAIK all NT-based windows versions (so NT, 2000, XP, and up) use UTC internally.
    But also all of them keep the local time in the hardware clock.
    It is possible to change that via a registry "hack", but at least on XP this has severe problems (f.e. the system time keeps jumping to UTC all the time).
    It should work better in later windows versions, but IIANM there are still issues with suspend/hibernate/resume at least (or have they been fixed already?)
    Anyway, I'd say this is getting off-topic here...
    Last edited by wolfi323; 16-Jun-2014 at 02:45.

  3. #13
    Join Date
    Nov 2009
    Location
    West Virginia Sector 13
    Posts
    15,760

    Default Re: MSQL Unable to set the UTC timezone permamently

    Well the time base for SQL will be the OS it is running in the time base for the OS will be in this case the VM the VM 's time base comes from either the host OS or the hardware, the host OS gets its reference from the hardware and the hardware is set periodically to an external time server. Now depending on the the OS's and VM being used time server etc you can get some odd results if you don't just set everything to use a UTC reference. Note that is the reference time not the displayed local time. Add a Windows that thinks the hardware is set to local and you may not really know the time

    Since SQL may be used from all over the world you may want the actually datetime strings to be in UTC and then an offset can be calculated from the UTC to display relative to any given local time. The thing is the system has to actually know the true UTC time and that may not be really available depending on the string of things I listed above.

    Datetime is not as simple as it first appears to be LOL

  4. #14

    Default Re: MSQL Unable to set the UTC timezone permamently

    Quote Originally Posted by gogalthorp View Post
    the VM 's time base comes from either the host OS or the hardware
    No, as I said, in the case of VirtualBox the guest's "hardware" clock comes from the host OS's system time, _not_ from the hardware. And it is adapted according the UTC setting in the VM's configuration.

    the host OS gets its reference from the hardware and the hardware is set periodically to an external time server.
    Yes, but it doesn't necessarily have to be set periodically to an external time server.
    But again, this doesn't really matter for the guest, as VirtualBox just takes the system time as base for the guest's emulated hardware clock.

    Now depending on the the OS's and VM being used time server etc you can get some odd results if you don't just set everything to use a UTC reference. Note that is the reference time not the displayed local time. Add a Windows that thinks the hardware is set to local and you may not really know the time
    Yes, but again, VirtualBox only cares about the host's OS time and passes that as hardware clock time to the guest, either directly or translated.

    Since SQL may be used from all over the world you may want the actually datetime strings to be in UTC and then an offset can be calculated from the UTC to display relative to any given local time.
    Well, that's how a Linux system does it. Use UTC internally and add an offset according to the timezone when the time is presented to the user.
    And AFAIK, Windows NT does the same as I said already.

    The thing is the system has to actually know the true UTC time and that may not be really available depending on the string of things I listed above.
    No idea about that.
    But the guest's kernel calculates in UTC, and the UTC time as well as local time should be available the same as on a "real" Linux system.
    Whether the time is correct or not is a different matter though, as I said.

    I've no idea whether VirtualBox gets the UTC time or the local time from Windows.

    Anyway, nowhere here comes the host's _hardware_ clock into play (that was my point), except when you boot the Windows host system as it gets the time from the hardware clock.
    But as long as the Windows' system clock is correct, the guest should have the correct time as well (no matter whether it uses UTC or local time).

    Datetime is not as simple as it first appears to be LOL
    Well, it is, as long as no localization/timezones come into play...

Page 2 of 2 FirstFirst 12

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •