Index: /trunk/include/iprt/time.h
===================================================================
--- /trunk/include/iprt/time.h	(revision 2611)
+++ /trunk/include/iprt/time.h	(revision 2612)
@@ -558,10 +558,10 @@
 
 /**
- * Gets the current system time.
+ * Gets the current system time (UCT).
  *
  * @returns pTime.
  * @param   pTime   Where to store the time.
  */
-RTR3DECL(PRTTIMESPEC) RTTimeNow(PRTTIMESPEC pTime);
+RTDECL(PRTTIMESPEC) RTTimeNow(PRTTIMESPEC pTime);
 
 /**
@@ -604,4 +604,12 @@
 
 /**
+ * Gets the current local system time.
+ *
+ * @returns pTime.
+ * @param   pTime   Where to store the local time.
+ */
+RTDECL(PRTTIMESPEC) RTTimeLocalNow(PRTTIMESPEC pTime);
+
+/**
  * Gets the delta between UTC and local time.
  *
@@ -613,5 +621,5 @@
  * @returns Returns the nanosecond delta between UTC and local time.
  */
-RTR3DECL(int64_t) RTTimeLocalDeltaNano(void);
+RTDECL(int64_t) RTTimeLocalDeltaNano(void);
 
 /**
@@ -620,7 +628,7 @@
  * @returns pTime.
  * @param   pTime       Where to store the exploded time.
- * @param   pTimeSpec   The time spec to exploded.
- */
-RTR3DECL(PRTTIME) RTTimeLocalExplode(PRTTIME pTime, PCRTTIMESPEC pTimeSpec);
+ * @param   pTimeSpec   The time spec to exploded (UCT).
+ */
+RTDECL(PRTTIME) RTTimeLocalExplode(PRTTIME pTime, PCRTTIMESPEC pTimeSpec);
 
 /**
Index: /trunk/src/VBox/Runtime/Makefile.kmk
===================================================================
--- /trunk/src/VBox/Runtime/Makefile.kmk	(revision 2611)
+++ /trunk/src/VBox/Runtime/Makefile.kmk	(revision 2612)
@@ -173,5 +173,5 @@
 	md5.cpp \
 	path.cpp \
-        req.cpp \
+	req.cpp \
 	r3/alloc-ef.cpp \
 	r3/alloc.cpp \
@@ -263,4 +263,5 @@
 	generic/RTFileMove-generic.cpp \
 	generic/RTLogWriteDebugger-generic.cpp \
+	generic/RTTimeLocalNow-generic.cpp \
 	generic/RTTimerCreate-generic.cpp \
 	r3/posix/RTTimeNow-posix.cpp \
@@ -280,4 +281,5 @@
 	r3/posix/thread-posix.cpp \
 	r3/linux/time-linux.cpp \
+	r3/posix/timelocal-posix.cpp \
 	r3/posix/timer-posix.cpp \
 	generic/utf16locale-generic.cpp \
@@ -296,4 +298,5 @@
 	generic/RTFileMove-generic.cpp \
 	generic/RTLogWriteDebugger-generic.cpp \
+	generic/RTTimeLocalNow-generic.cpp \
 	generic/RTTimerCreate-generic.cpp \
 	os2/RTErrConvertFromOS2.cpp \
@@ -316,4 +319,5 @@
 	generic/sched-generic.cpp \
 	r3/os2/time-os2.cpp \
+	r3/posix/timelocal-posix.cpp \
 	generic/timer-generic.cpp \
 	r3/posix/RTTimeNow-posix.cpp \
@@ -331,4 +335,5 @@
 	generic/RTFileMove-generic.cpp \
 	generic/RTLogWriteDebugger-generic.cpp \
+	generic/RTTimeLocalNow-generic.cpp \
 	generic/RTTimerCreate-generic.cpp \
 	generic/pathhost-generic.cpp \
@@ -350,6 +355,7 @@
 	r3/posix/system-posix.cpp \
 	r3/posix/thread-posix.cpp \
+	r3/darwin/time-darwin.cpp \
+	r3/posix/timelocal-posix.cpp \
 	r3/posix/utf8-posix.cpp \
-	r3/darwin/time-darwin.cpp \
 	timesup.cpp \
 
@@ -378,4 +384,5 @@
 	r3/posix/thread-posix.cpp \
 	r3/posix/time-posix.cpp \
+	r3/posix/timelocal-posix.cpp \
 	r3/posix/timer-posix.cpp \
 	r3/posix/RTTimeNow-posix.cpp \
@@ -399,4 +406,5 @@
 	generic/RTFileMove-generic.cpp \
 	generic/RTLogWriteDebugger-generic.cpp \
+	generic/RTTimeLocalNow-generic.cpp \
 	generic/fs-stubs-generic.cpp \
 	generic/pathhost-generic.cpp \
@@ -422,4 +430,5 @@
 	r3/posix/rand-posix.cpp \
 	r3/posix/time-posix.cpp \
+	r3/posix/timelocal-posix.cpp \
 	r3/posix/RTTimeNow-posix.cpp \
 	timesup.cpp
Index: /trunk/src/VBox/Runtime/r3/posix/RTTimeNow-posix.cpp
===================================================================
--- /trunk/src/VBox/Runtime/r3/posix/RTTimeNow-posix.cpp	(revision 2611)
+++ /trunk/src/VBox/Runtime/r3/posix/RTTimeNow-posix.cpp	(revision 2612)
@@ -38,5 +38,5 @@
  * @param   pTime   Where to store the time.
  */
-RTR3DECL(PRTTIMESPEC) RTTimeNow(PRTTIMESPEC pTime)
+RTDECL(PRTTIMESPEC) RTTimeNow(PRTTIMESPEC pTime)
 {
     struct timeval tv;
Index: /trunk/src/VBox/Runtime/r3/win32/time-win32.cpp
===================================================================
--- /trunk/src/VBox/Runtime/r3/win32/time-win32.cpp	(revision 2611)
+++ /trunk/src/VBox/Runtime/r3/win32/time-win32.cpp	(revision 2612)
@@ -42,4 +42,5 @@
 #include <iprt/time.h>
 #include <iprt/asm.h>
+#include <iprt/assert.h>
 #include "internal/time.h"
 
@@ -137,9 +138,93 @@
  * @param   pTime   Where to store the time.
  */
-RTR3DECL(PRTTIMESPEC) RTTimeNow(PRTTIMESPEC pTime)
-{
-    uint64_t u64; /* manual say larger integer, should be safe to assume it's the same. */
+RTDECL(PRTTIMESPEC) RTTimeNow(PRTTIMESPEC pTime)
+{
+    uint64_t u64;
+    AssertCompile(sizeof(u64) == sizeof(FILETIME));
     GetSystemTimeAsFileTime((LPFILETIME)&u64);
     return RTTimeSpecSetNtTime(pTime, u64);
 }
 
+
+/**
+ * Gets the current local system time.
+ *
+ * @returns pTime.
+ * @param   pTime   Where to store the local time.
+ */
+RTDECL(PRTTIMESPEC) RTTimeLocalNow(PRTTIMESPEC pTime)
+{
+    uint64_t u64;
+    AssertCompile(sizeof(u64) == sizeof(FILETIME));
+    GetSystemTimeAsFileTime((LPFILETIME)&u64);
+    uint64_t u64Local;
+    if (!FileTimeToLocalFileTime((FILETIME const *)&u64, (LPFILETIME)&u64Local))
+        u64Local = u64;
+    return RTTimeSpecSetNtTime(pTime, u64);
+}
+
+
+/**
+ * Gets the delta between UTC and local time.
+ *
+ * @code
+ *      RTTIMESPEC LocalTime;
+ *      RTTimeSpecAddNano(RTTimeNow(&LocalTime), RTTimeLocalDeltaNano());
+ * @endcode
+ *
+ * @returns Returns the nanosecond delta between UTC and local time.
+ */
+RTDECL(int64_t) RTTimeLocalDeltaNano(void)
+{
+    /*
+     * UCT = local + Tzi.Bias;
+     * The bias is given in minutes.
+     */
+    TIME_ZONE_INFORMATION Tzi;
+    Tzi.Bias = 0;
+    if (GetTimeZoneInformation(&Tzi) != TIME_ZONE_ID_INVALID)
+        return -(int64_t)Tzi.Bias * 60*1000*1000*1000;
+    return 0;
+}
+
+
+/**
+ * Explodes a time spec to the localized timezone.
+ *
+ * @returns pTime.
+ * @param   pTime       Where to store the exploded time.
+ * @param   pTimeSpec   The time spec to exploded. (UCT)
+ */
+RTDECL(PRTTIME) RTTimeLocalExplode(PRTTIME pTime, PCRTTIMESPEC pTimeSpec)
+{
+    /*
+     * FileTimeToLocalFileTime does not do the right thing, so we'll have
+     * to convert to system time and SystemTimeToTzSpecificLocalTime instead.
+     */
+    RTTIMESPEC LocalTime;
+    SYSTEMTIME SystemTimeIn;
+    FILETIME FileTime;
+    if (FileTimeToSystemTime(RTTimeSpecGetNtFileTime(pTimeSpec, &FileTime), &SystemTimeIn))
+    {
+        SYSTEMTIME SystemTimeOut;
+        if (SystemTimeToTzSpecificLocalTime(NULL /* use current TZI */,
+                                            &SystemTimeIn,
+                                            &SystemTimeOut))
+        {
+            if (SystemTimeToFileTime(&SystemTimeOut, &FileTime))
+            {
+                RTTimeSpecSetNtFileTime(&LocalTime, &FileTime);
+                return RTTimeExplode(pTime, &LocalTime);
+            }
+        }
+    }
+
+    /*
+     * The fallback is to use the current offset.
+     * (A better fallback would be to use the offset of the same time of the year.)
+     */
+    LocalTime = *pTimeSpec;
+    RTTimeSpecAddNano(&LocalTime, RTTimeLocalDeltaNano());
+    return RTTimeExplode(pTime, &LocalTime);
+}
+
