forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Time zone

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 3 Source Code
View previous topic :: View next topic  
Author Message
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Tue Nov 19, 2002 12:40 pm    Post subject: Time zone Reply with quote

Obtain time zone info from the Registry and obtain the computer's offset from GMT time etc.

Greetz
Dr. Dread

Code:

  option decimalsep,"."
  rem Get values from Registry
  %%zonename = @regread(LOCAL,SYSTEM\CurrentControlSet\Control\TimeZoneInformation,Standardname)
  %%info = Time zone:@Tab()%%zonename
 
  %%bias = @regread(LOCAL,SYSTEM\CurrentControlSet\Control\TimeZoneInformation,ActiveTimeBias)
  rem WinNT/XP/2000 will return an integer, e.g. -120
  rem Win9x will return a value like this 136|255|255|255 - convert it to an integer
  if @greater(@pos(|,%%bias),0)
    parse "%1;%2;%3;%4",%%bias
    %%bias = @sum(@sum(@sum(%1,@prod(256,%2)),@prod(65536,%3)),@prod(16777216,%4))
  end

  rem Get the system's own time
  %%local = @datetime()
  %%info = %%info@CR()Local time:@Tab()@datetime(tt "("dddddd")")

  rem Compute GMT time from that value - to get true GMT time use a time server
  rem First find out the value of 1 minute
  %%minute = @format(@fdiv(1,1440),.12)
  rem Then extrapolate GMT time (local time + the value of the timezone bias)
  %%GMT = @fadd(@format(%%local,.12),@fmul(%%bias,%%minute))
  %%info = %%info@CR()GMT time:@TAB()@datetime(tt "("dddddd")",%%GMT)

  rem Show offset
  %%offset = @div(%%bias,-60)
  if @equal(%%offset,1)@equal(%%offset,-1)
    %%offset = %%offset hour
  else
    %%offset = %%offset hours
  end
  %%info = %%info@CR()Offset:@Tab()@Tab()%%offset
 
  info %%info

_________________
~~ Alcohol and calculus don't mix... Don't drink and derive! ~~

String.DLL * advanced string processing
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 3 Source Code All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group