Index: /trunk/include/VBox/settings.h
===================================================================
--- /trunk/include/VBox/settings.h	(revision 25671)
+++ /trunk/include/VBox/settings.h	(revision 25672)
@@ -13,5 +13,5 @@
 
 /*
- * Copyright (C) 2007-2009 Sun Microsystems, Inc.
+ * Copyright (C) 2007-2010 Sun Microsystems, Inc.
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -623,4 +623,5 @@
     com::Utf8Str            strTeleporterAddress;
     com::Utf8Str            strTeleporterPassword;
+    bool                    fRTCUseUTC;
 
     bool                    fCurrentStateModified;      // optional, default is true
Index: /trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp	(revision 25671)
+++ /trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp	(revision 25672)
@@ -163,4 +163,5 @@
                  "                            [--cpuidremoveall]\n"
                  "                            [--cpus <number>]\n"
+                 "                            [--rtcuseutc]\n"
                  "                            [--monitorcount <number>]\n"
                  "                            [--accelerate3d <on|off>]\n"
Index: /trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp	(revision 25671)
+++ /trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp	(revision 25672)
@@ -397,4 +397,11 @@
     else
         RTPrintf("Time offset:     %lld ms\n", timeOffset);
+
+    BOOL RTCUseUTC;
+    machine->COMGETTER(RTCUseUTC)(&RTCUseUTC);
+    if (details == VMINFO_MACHINEREADABLE)
+        RTPrintf("rtcuseutc=\"%s\"\n", RTCUseUTC ? "on" : "off");
+    else
+        RTPrintf("RTC:             %s\n", RTCUseUTC ? "UTC" : "local time");
 
     BOOL hwVirtExEnabled;
Index: /trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp	(revision 25671)
+++ /trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp	(revision 25672)
@@ -123,4 +123,5 @@
     MODIFYVM_VRDPREUSECON,
     MODIFYVM_VRDP,
+    MODIFYVM_RTCUSEUTC,
     MODIFYVM_USBEHCI,
     MODIFYVM_USB,
@@ -152,4 +153,5 @@
     { "--cpuidremoveall",           MODIFYVM_DELALLCPUID,               RTGETOPT_REQ_NOTHING},
     { "--cpus",                     MODIFYVM_CPUS,                      RTGETOPT_REQ_UINT32 },
+    { "--rtcuseutc",                MODIFYVM_RTCUSEUTC,                 RTGETOPT_REQ_BOOL_ONOFF },
     { "--monitorcount",             MODIFYVM_MONITORCOUNT,              RTGETOPT_REQ_UINT32 },
     { "--accelerate3d",             MODIFYVM_ACCELERATE3D,              RTGETOPT_REQ_BOOL_ONOFF },
@@ -415,4 +417,10 @@
             }
 
+            case MODIFYVM_RTCUSEUTC:
+            {
+                CHECK_ERROR(machine, COMSETTER(RTCUseUTC)(ValueUnion.f));
+                break;
+            }
+
             case MODIFYVM_MONITORCOUNT:
             {
Index: /trunk/src/VBox/Main/ConsoleImpl2.cpp
===================================================================
--- /trunk/src/VBox/Main/ConsoleImpl2.cpp	(revision 25671)
+++ /trunk/src/VBox/Main/ConsoleImpl2.cpp	(revision 25672)
@@ -10,5 +10,5 @@
 
 /*
- * Copyright (C) 2006-2009 Sun Microsystems, Inc.
+ * Copyright (C) 2006-2010 Sun Microsystems, Inc.
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -623,4 +623,7 @@
     rc = CFGMR3InsertNode(pDev,     "0", &pInst);                                   RC_CHECK();
     rc = CFGMR3InsertNode(pInst,    "Config", &pCfg);                               RC_CHECK();
+    BOOL fRTCUseUTC;
+    hrc = pMachine->COMGETTER(RTCUseUTC)(&fRTCUseUTC);                              H();
+    rc = CFGMR3InsertInteger(pCfg,  "UseUTC", fRTCUseUTC ? 1 : 0);
 
     /*
Index: /trunk/src/VBox/Main/MachineImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/MachineImpl.cpp	(revision 25671)
+++ /trunk/src/VBox/Main/MachineImpl.cpp	(revision 25672)
@@ -6,5 +6,5 @@
 
 /*
- * Copyright (C) 2006-2009 Sun Microsystems, Inc.
+ * Copyright (C) 2006-2010 Sun Microsystems, Inc.
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -56,7 +56,4 @@
 #include "Logging.h"
 #include "Performance.h"
-
-#include <stdio.h>
-#include <stdlib.h>
 
 #include <iprt/asm.h>
@@ -2229,4 +2226,48 @@
     mUserData.backup();
     mUserData->mTeleporterPassword = aPassword;
+
+    return S_OK;
+}
+
+STDMETHODIMP
+Machine::COMGETTER(RTCUseUTC)(BOOL *aEnabled)
+{
+    CheckComArgOutPointerValid(aEnabled);
+
+    AutoCaller autoCaller(this);
+    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    *aEnabled = mUserData->mRTCUseUTC;
+
+    return S_OK;
+}
+
+STDMETHODIMP
+Machine::COMSETTER(RTCUseUTC)(BOOL aEnabled)
+{
+    AutoCaller autoCaller(this);
+    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    /* Only allow it to be set to true when PoweredOff or Aborted.
+       (Clearing it is always permitted.) */
+    if (    aEnabled
+        &&  mData->mRegistered
+        &&  (   mType != IsSessionMachine
+             || (   mData->mMachineState != MachineState_PoweredOff
+                 && mData->mMachineState != MachineState_Teleported
+                 && mData->mMachineState != MachineState_Aborted
+                )
+            )
+       )
+        return setError(VBOX_E_INVALID_VM_STATE,
+                        tr("The machine is not powered off (state is %s)"),
+                        Global::stringifyMachineState(mData->mMachineState));
+
+    mUserData.backup();
+    mUserData->mRTCUseUTC = aEnabled;
 
     return S_OK;
@@ -5756,4 +5797,7 @@
         mUserData->mTeleporterPassword = mData->m_pMachineConfigFile->strTeleporterPassword;
 
+        /* RTC */
+        mUserData->mRTCUseUTC = mData->m_pMachineConfigFile->fRTCUseUTC;
+
         /*
          *  note: all mUserData members must be assigned prior this point because
@@ -6814,4 +6858,6 @@
         mData->m_pMachineConfigFile->strTeleporterAddress  = mUserData->mTeleporterAddress;
         mData->m_pMachineConfigFile->strTeleporterPassword = mUserData->mTeleporterPassword;
+
+        mData->m_pMachineConfigFile->fRTCUseUTC = !!mUserData->mRTCUseUTC;
 
         rc = saveHardware(mData->m_pMachineConfigFile->hardwareMachine);
Index: /trunk/src/VBox/Main/idl/VirtualBox.xidl
===================================================================
--- /trunk/src/VBox/Main/idl/VirtualBox.xidl	(revision 25671)
+++ /trunk/src/VBox/Main/idl/VirtualBox.xidl	(revision 25672)
@@ -46,5 +46,5 @@
  *    (<result> extraction for the %Rhrc format specifier)
  *
-     Copyright (C) 2006-2009 Sun Microsystems, Inc.
+     Copyright (C) 2006-2010 Sun Microsystems, Inc.
 
      This file is part of VirtualBox Open Source Edition (OSE), as
@@ -454,6 +454,11 @@
            -->
     </const>
-    <const name="Future"     value="12">
-      <desc>Settings version greater than "1.9", written by a future VirtualBox version.</desc>
+    <const name="v1_10"     value="12">
+      <desc>Settings version "1.10", written by VirtualBox 3.2.x.</desc>
+      <!-- Machine changes: RTC localOrUTC (done)
+           -->
+    </const>
+    <const name="Future"     value="13">
+      <desc>Settings version greater than "1.10", written by a future VirtualBox version.</desc>
     </const>
   </enum>
@@ -4160,5 +4165,5 @@
   <interface
      name="IMachine" extends="$unknown"
-     uuid="99404f50-dd10-40d3-889b-dd2f79f1e95e"
+     uuid="6d7f40fa-77be-4366-a053-f58e81453a6a"
      wsmap="managed"
      >
@@ -4666,4 +4671,12 @@
     </attribute>
 
+    <attribute name="RTCUseUTC" type="boolean">
+      <desc>
+        When set to @a true, the RTC device of the virtual machine will run
+        in UTC time, otherwise in local time. Especially Unix guests prefer
+        the time in UTC.
+      </desc>
+    </attribute>
+
     <method name="setBootOrder">
       <desc>
Index: /trunk/src/VBox/Main/include/MachineImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/MachineImpl.h	(revision 25671)
+++ /trunk/src/VBox/Main/include/MachineImpl.h	(revision 25672)
@@ -7,5 +7,5 @@
 
 /*
- * Copyright (C) 2006-2009 Sun Microsystems, Inc.
+ * Copyright (C) 2006-2010 Sun Microsystems, Inc.
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -238,5 +238,6 @@
                     && mTeleporterPort       == that.mTeleporterPort
                     && mTeleporterAddress    == that.mTeleporterAddress
-                    && mTeleporterPassword   == that.mTeleporterPassword);
+                    && mTeleporterPassword   == that.mTeleporterPassword
+                    && mRTCUseUTC            == that.mRTCUseUTC);
         }
 
@@ -251,4 +252,5 @@
         Bstr    mTeleporterAddress;
         Bstr    mTeleporterPassword;
+        BOOL    mRTCUseUTC;
     };
 
@@ -577,4 +579,6 @@
     STDMETHOD(COMGETTER(TeleporterPassword))(BSTR *aPassword);
     STDMETHOD(COMSETTER(TeleporterPassword))(IN_BSTR aPassword);
+    STDMETHOD(COMGETTER(RTCUseUTC))(BOOL *aEnabled);
+    STDMETHOD(COMSETTER(RTCUseUTC))(BOOL aEnabled);
 
     // IMachine methods
Index: /trunk/src/VBox/Main/xml/Settings.cpp
===================================================================
--- /trunk/src/VBox/Main/xml/Settings.cpp	(revision 25671)
+++ /trunk/src/VBox/Main/xml/Settings.cpp	(revision 25672)
@@ -29,6 +29,6 @@
  *
  *   3) In the settings writer method, write the setting _only_ if the current settings
- *      version (stored in m->sv) is high enough. That is, for VirtualBox 3.1, write it
- *      only if (m->sv >= SettingsVersion_v1_9).
+ *      version (stored in m->sv) is high enough. That is, for VirtualBox 3.2, write it
+ *      only if (m->sv >= SettingsVersion_v1_10).
  *
  *   4) In MachineConfigFile::bumpSettingsVersionIfNeeded(), check if the new setting has
@@ -42,5 +42,5 @@
 
 /*
- * Copyright (C) 2007-2009 Sun Microsystems, Inc.
+ * Copyright (C) 2007-2010 Sun Microsystems, Inc.
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -279,5 +279,7 @@
                 else if (ulMinor == 9)
                     m->sv = SettingsVersion_v1_9;
-                else if (ulMinor > 9)
+                else if (ulMinor == 10)
+                    m->sv = SettingsVersion_v1_10;
+                else if (ulMinor > 10)
                     m->sv = SettingsVersion_Future;
             }
@@ -298,5 +300,5 @@
     {
         m->strSettingsVersionFull = VBOX_XML_VERSION_FULL;
-        m->sv = SettingsVersion_v1_9;
+        m->sv = SettingsVersion_v1_10;
     }
 }
@@ -545,12 +547,16 @@
         case SettingsVersion_v1_8:
             pcszVersion = "1.8";
-        break;
+            break;
 
         case SettingsVersion_v1_9:
+            pcszVersion = "1.9";
+            break;
+
+        case SettingsVersion_v1_10:
         case SettingsVersion_Future:                // can be set if this code runs on XML files that were created by a future version of VBox;
                                                     // in that case, downgrade to current version when writing since we can't write future versions...
-            pcszVersion = "1.9";
-            m->sv = SettingsVersion_v1_9;
-        break;
+            pcszVersion = "1.10";
+            m->sv = SettingsVersion_v1_10;
+            break;
 
         default:
@@ -558,5 +564,5 @@
             pcszVersion = "1.7";
             m->sv = SettingsVersion_v1_7;
-        break;
+            break;
     }
 
@@ -1775,4 +1781,10 @@
         else if (pelmHwChild->nameEquals("Network"))
             readNetworkAdapters(*pelmHwChild, hw.llNetworkAdapters);
+        else if (pelmHwChild->nameEquals("RTC"))
+        {
+            Utf8Str strLocalOrUTC;
+            fRTCUseUTC =    pelmHwChild->getAttributeValue("localOrUTC", strLocalOrUTC)
+                         && strLocalOrUTC == "UTC";
+        }
         else if (    (pelmHwChild->nameEquals("UART"))
                   || (pelmHwChild->nameEquals("Uart"))      // used before 1.3
@@ -1780,5 +1792,5 @@
             readSerialPorts(*pelmHwChild, hw.llSerialPorts);
         else if (    (pelmHwChild->nameEquals("LPT"))
-                  ||  (pelmHwChild->nameEquals("Lpt"))      // used before 1.3
+                  || (pelmHwChild->nameEquals("Lpt"))       // used before 1.3
                 )
             readParallelPorts(*pelmHwChild, hw.llParallelPorts);
@@ -2411,4 +2423,5 @@
       fTeleporterEnabled(false),
       uTeleporterPort(0),
+      fRTCUseUTC(false),
       fCurrentStateModified(true),
       fAborted(false)
@@ -2766,4 +2779,11 @@
     pelmAudio->setAttribute("controller", (hw.audioAdapter.controllerType == AudioControllerType_SB16) ? "SB16" : "AC97");
 
+    if (   m->sv >= SettingsVersion_v1_10
+        && fRTCUseUTC)
+    {
+        xml::ElementNode *pelmRTC = pelmHardware->createChild("RTC");
+        pelmRTC->setAttribute("localOrUTC", fRTCUseUTC ? "UTC" : "local");
+    }
+
     const char *pcszDriver;
     switch (hw.audioAdapter.driverType)
@@ -3069,4 +3089,10 @@
             m->sv = SettingsVersion_v1_9;
     }
+
+    if (    m->sv < SettingsVersion_v1_10
+         && (  fRTCUseUTC
+            )
+       )
+        m->sv = SettingsVersion_v1_10;
 }
 
