=== modified file 'source/appModules/_default.py'
--- source/appModules/_default.py	2009-10-31 17:39:37 +0000
+++ source/appModules/_default.py	2009-11-10 19:17:11 +0000
@@ -93,9 +93,9 @@
 
 	def script_dateTime(self,keyPress):
 		if scriptHandler.getLastScriptRepeatCount()==0:
-			text=winKernel.GetTimeFormat(winKernel.getThreadLocale(), winKernel.TIME_NOSECONDS, None, None)
+			text=winKernel.GetTimeFormat(winKernel.LOCALE_USER_DEFAULT, winKernel.TIME_NOSECONDS, None, None)
 		else:
-			text=winKernel.GetDateFormat(winKernel.getThreadLocale(), winKernel.DATE_LONGDATE, None, None)
+			text=winKernel.GetDateFormat(winKernel.LOCALE_USER_DEFAULT, winKernel.DATE_LONGDATE, None, None)
 		ui.message(text)
 	script_dateTime.__doc__=_("If pressed once, reports the current time. If pressed twice, reports the current date")
 

=== modified file 'source/winKernel.py'
--- source/winKernel.py	2009-11-03 04:04:58 +0000
+++ source/winKernel.py	2009-11-10 19:29:07 +0000
@@ -70,17 +70,20 @@
 
 def GetSystemPowerStatus(sps):
 	return kernel32.GetSystemPowerStatus(ctypes.byref(sps))
+
 def getThreadLocale():
 	return kernel32.GetThreadLocale()
 
 def GetDateFormat(Locale,dwFlags,lpDate,lpFormat):
-	buf=ctypes.create_unicode_buffer("", 32)
-	kernel32.GetDateFormatW(Locale, dwFlags, lpDate, lpFormat, buf, ctypes.sizeof(buf))
+	bufferLength=kernel32.GetDateFormatW(Locale, dwFlags, lpDate, lpFormat, None, 0)
+	buf=ctypes.create_unicode_buffer("", bufferLength)
+	kernel32.GetDateFormatW(Locale, dwFlags, lpDate, lpFormat, buf, bufferLength)
 	return buf.value
 
 def GetTimeFormat(Locale,dwFlags,lpTime,lpFormat):
-	buf=ctypes.create_unicode_buffer("", 32)
-	kernel32.GetTimeFormatW(Locale,dwFlags,lpTime,lpFormat, buf, ctypes.sizeof(buf))
+	bufferLength=kernel32.GetTimeFormatW(Locale,dwFlags,lpTime,lpFormat, None, 0)
+	buf=ctypes.create_unicode_buffer("", bufferLength)
+	kernel32.GetTimeFormatW(Locale,dwFlags,lpTime,lpFormat, buf, bufferLength)
 	return buf.value
 
 def openProcess(*args):


