Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Basic4ppc Wishlist
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Basic4ppc Wishlist Missing any feature?


Time Zone


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-02-2007, 08:02 AM
alfcen's Avatar
Basic4ppc Veteran
 
Join Date: Apr 2007
Location: Okinawa, Ryukyu
Posts: 424
Awards Showcase
Beta Tester 
Total Awards: 1
Default Time Zone

Hello
The hardware.dll could eventually be enabled to retrieve the Time Zone Information :-)
Thanks
Robert
Reply With Quote
  #2 (permalink)  
Old 10-02-2007, 04:30 PM
specci48's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: Germany
Posts: 638
Default

Until the library is updated, you may retrieve this information by reading out the registry directly: http://msdn2.microsoft.com/en-us/library/aa909148.aspx

specci48
Reply With Quote
  #3 (permalink)  
Old 10-03-2007, 04:32 AM
alfcen's Avatar
Basic4ppc Veteran
 
Join Date: Apr 2007
Location: Okinawa, Ryukyu
Posts: 424
Awards Showcase
Beta Tester 
Total Awards: 1
Default

That's very kind of you speeci48. Unfortunatelty, I am not in to C and therefore quite helpless at seeing this page
Reply With Quote
  #4 (permalink)  
Old 10-03-2007, 11:30 AM
specci48's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: Germany
Posts: 638
Default


I only had a quick look at that page and thought it would describe the registry entry where the time zone is stored on mobile devices...
Reply With Quote
  #5 (permalink)  
Old 10-04-2007, 05:51 PM
alfcen's Avatar
Basic4ppc Veteran
 
Join Date: Apr 2007
Location: Okinawa, Ryukyu
Posts: 424
Awards Showcase
Beta Tester 
Total Awards: 1
Default

No problem at all, specci48, I know where to find it in the registry, but the data is coded in binary which is alien to me at least for now.
Cheers
Robert
Reply With Quote
  #6 (permalink)  
Old 10-04-2007, 07:42 PM
specci48's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: Germany
Posts: 638
Default

... and where is it stored in the registry?
Reply With Quote
  #7 (permalink)  
Old 10-05-2007, 03:06 AM
alfcen's Avatar
Basic4ppc Veteran
 
Join Date: Apr 2007
Location: Okinawa, Ryukyu
Posts: 424
Awards Showcase
Beta Tester 
Total Awards: 1
Default

here you go...

HKEY_LOCAL_MACHINE\Time\TimeZoneInformation

The value is stored in minutes to account for 'exotic' time zones and is further negative for eastern zones.

I think the TZ can be extracted with the binary.dll with a few lines of code.

I did that before in embVB like this :

homezone = StringToLong(ReadReg(HKEY_LOCAL_MACHINE, "\Time", "TimeZoneInformation")) / 60 * -1

Private Function StringToLong(strValue As String) As Long
Dim strTemp As String
Dim intByte As Long
On Error Resume Next
For intByte = 4 To 1 Step -1
strTemp = strTemp & Hex(AscB(MidB(strValue, intByte, 1)))
Next intByte
StringToLong = CLng("&H" & strTemp)
End Function
Reply With Quote
  #8 (permalink)  
Old 10-05-2007, 03:48 AM
alfcen's Avatar
Basic4ppc Veteran
 
Join Date: Apr 2007
Location: Okinawa, Ryukyu
Posts: 424
Awards Showcase
Beta Tester 
Total Awards: 1
Default

and on the desktop...

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Contro l\TimeZoneInformation
Reply With Quote
  #9 (permalink)  
Old 10-05-2007, 06:47 AM
alfcen's Avatar
Basic4ppc Veteran
 
Join Date: Apr 2007
Location: Okinawa, Ryukyu
Posts: 424
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Hi again
Here are the routines.
Tested with PPC2003SE, not tested under WM5.x/6.x.
Tested on desktop with XP Home Edition.
Perhaps there is a more elegant solution involving less code.
Please use or abuse


Sub App_Start
Reg.New1 'registry.dll
Bit.New1 'bitwise.dll
End Sub

Sub Globals
Dim zti(0) As Byte 'Array for binary data (PPC), registry entry is binary
End Sub

Sub GetTimeZone
Dim m, i
Reg.RootKey(Reg.rtLocalMachine)
If CPPC = True Then
zti()=Reg.GetValue("Time","TimeZoneInformation")
For i = 3 To 0 Step -1
m = m & bit.DecToHex(zti(i))
Next
Return bit.HexToDec(m) / 60 * (-1)
Else
m = Reg.GetValue("System\CurrentControlSet\Control\Tim eZoneInformation","ActiveTimeBias")
Return m / 60 * (-1)
End If
End Sub

Sub GetDayLightSavingHour
'for the desktop only
Return Reg.GetValue("System\CurrentControlSet\Control\Tim eZoneInformation","StandardBias")
End Sub
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mars Time alfcen Share Your Creations 4 05-12-2008 12:21 PM
Time Addition busboy Questions & Help Needed 3 10-01-2007 02:41 PM
Date and Time Erel Tutorials 0 09-24-2007 10:05 AM
Load time BPak Questions & Help Needed 3 08-28-2007 04:27 AM
.NET 3.0 and 3.5 / Time Zone alfcen Questions & Help Needed 3 08-23-2007 06:58 PM


All times are GMT. The time now is 12:30 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0