Jump to content











Photo
- - - - -

Automatic timezone setting for PE


  • Please log in to reply
15 replies to this topic

#1 MedEvil

MedEvil

    Platinum Member

  • .script developer
  • 7771 posts

Posted 13 July 2012 - 07:05 PM

I've been toying around with the idea to use ip-geo-locating to set the correct timezone in a PE. Pretty useful, i think, for those of us, who can't even go on vacation without a PE. ;)

The question, i have not yet found an answer for and hope of your help for, is, does it matter, which exact timezone is set, as long as the offset to UTC/GMT is correct?

:cheers:

#2 Max_Real Qnx

Max_Real Qnx

    Gold Member

  • Patrician
  • 1382 posts
  • Location:Istanbul
  • Interests:To be or not to be that is the question.
  •  
    Turkey

Posted 13 July 2012 - 07:28 PM

Hi MedEvil ;)

I do not know. However, such a method might be useful. Best regards :hi:

(Author by dera)

[Variables]

%var076%=--

%var077%=--

%var078%=--

%var079%=--

%var080%=--

%var081%=--

%var082%=--

%var083%=--

%var084%=--

%var085%=--



[Process]

If,NOT,EXISTFILE,"%Target_Sys%w32time.dll",Require_FileQ,"w32time.dll"

If,NOT,EXISTFILE,"%Target_Sys%tzres.dll",Require_FileQ,"tzres.dll"

//

Hive_Load,HKLM

Echo,"Writing new values on registry hive.."

reg_add,0x4,"%reg%ControlSet001servicesW32Time","Start","2"

reg_add,0x1,"%reg%SetupAllowStartW32Time"

RegRead,HKLM,"SystemControlSet001ControlTimeZoneInformation","Bias","%var076%"

If,NOT,"%var076%",EQUAL,"--",reg_add,0x4,"%reg%ControlSet001ControlTimeZoneInformation","Bias","%var076%"

RegRead,HKLM,"SystemControlSet001ControlTimeZoneInformation","DaylightBias","%var077%"

If,NOT,"%var077%",EQUAL,"--",reg_add,0x4,"%reg%ControlSet001ControlTimeZoneInformation","DaylightBias","%var077%"

RegRead,HKLM,"SystemControlSet001ControlTimeZoneInformation","DaylightName","%var078%"

If,NOT,"%var078%",EQUAL,"--",reg_add,0x1,"%reg%ControlSet001ControlTimeZoneInformation","DaylightName","%var078%"

RegRead,HKLM,"SystemControlSet001ControlTimeZoneInformation","DaylightStart","%var079%"

If,NOT,"%var079%",EQUAL,"--",reg_add,0x3,"%reg%ControlSet001ControlTimeZoneInformation","DaylightStart","%var079%"

RegRead,HKLM,"SystemControlSet001ControlTimeZoneInformation","StandardBias","%var080%"

If,NOT,"%var080%",EQUAL,"--",reg_add,0x4,"%reg%ControlSet001ControlTimeZoneInformation","StandardBias","%var080%"

RegRead,HKLM,"SystemControlSet001ControlTimeZoneInformation","StandardName","%var081%"

If,NOT,"%var081%",EQUAL,"--",reg_add,0x1,"%reg%ControlSet001ControlTimeZoneInformation","StandardName","%var081%"

RegRead,HKLM,"SystemControlSet001ControlTimeZoneInformation","StandardStart","%var082%"

If,NOT,"%var082%",EQUAL,"--",reg_add,0x3,"%reg%ControlSet001ControlTimeZoneInformation","StandardStart","%var082%"

RegRead,HKLM,"SystemControlSet001ControlTimeZoneInformation","TimeZoneKeyName","%var083%"

If,NOT,"%var083%",EQUAL,"--",reg_add,0x1,"%reg%ControlSet001ControlTimeZoneInformation","TimeZoneKeyName","%var083%"

RegRead,HKLM,"SystemControlSet001ControlTimeZoneInformation","DynamicDaylightTimeDisabled","%var084%"

If,NOT,"%var084%",EQUAL,"--",reg_add,0x4,"%reg%ControlSet001ControlTimeZoneInformation","DynamicDaylightTimeDisabled","%var084%"

RegRead,HKLM,"SystemControlSet001ControlTimeZoneInformation","ActiveTimeBias","%var085%"

If,NOT,"%var085%",EQUAL,"--",reg_add,0x4,"%reg%ControlSet001ControlTimeZoneInformation","ActiveTimeBias","%var085%"

Hive_Unload,HKLM



#3 ChrisR

ChrisR

    Silver Member

  • .script developer
  • 784 posts
  •  
    France

Posted 13 July 2012 - 11:54 PM

Same things without geo-locating,
in addition W32Time services (Start,2) and Tmp_System\Setup\AllowStart\W32Time

// Allow to start the W32Time service should set the registry permission on the '\services\W32Time'
ShellExecute,Hide,%Tools%\%OSArch%\SetAcl.exe,"-on HKLM\Tmp_System\ControlSet001\services\W32Time -ot reg -rec yes -actn ace -ace n:S-1-1-0;p:full;s:y"
If,Not,%ExitCode%,Equal,0,Run,%ScriptFile%,EchoWarn10,"SetAcl - NTFS permission on Tmp_System\ControlSet001\services\W32Time FAIL"
// Eventually net start W32time at startup to update internet time

Also, I do not write ActiveTimeBias to keep the Bios time.

:cheers:

#4 MedEvil

MedEvil

    Platinum Member

  • .script developer
  • 7771 posts

Posted 14 July 2012 - 01:17 AM

You misunderstood, what i wanna do. I don't want to set the timezone during build. That's pretty useless, when taking the PE along on a trip.

I want to create a program, which is automaticaly run right after PENetwork. This way, no matter where you build your PE and no matter where you are now, the PE will show the correct local time.

:cheers:

#5 Guest_Boot_Monkey_*

Guest_Boot_Monkey_*
  • Guests

Posted 14 July 2012 - 05:43 AM

Pretty sure pscEx is working on the same thing.

#6 pscEx

pscEx

    Platinum Member

  • Team Reboot
  • 12702 posts
  • Location:Korschenbroich, Germany
  • Interests:What somebody else cannot do.
  •  
    European Union

Posted 14 July 2012 - 06:59 AM

I want to create a program, which is automaticaly run right after PENetwork. This way, no matter where you build your PE and no matter where you are now, the PE will show the correct local time.

During boot:

hostGrab.exe -ATTZ

hostGrab.exe you can find as part of the multiPE project in
PEFactory > Config > BootTasks.script.
Attached File  BootTasks.gif   25.63KB   12 downloads

Peter :cheers:

#7 MedEvil

MedEvil

    Platinum Member

  • .script developer
  • 7771 posts

Posted 14 July 2012 - 01:14 PM

That's another way of doing it. Never thought of that. Very clever! :thumbsup:

It however works only on a local computer, not a Laptop which was setup in Germany and now BSOD in Australia.

:cheers:

#8 Max_Real Qnx

Max_Real Qnx

    Gold Member

  • Patrician
  • 1382 posts
  • Location:Istanbul
  • Interests:To be or not to be that is the question.
  •  
    Turkey

Posted 14 July 2012 - 03:23 PM

If use combination with the second post, I believe its would be useful for you.

http://reboot.pro/fi...ime-sync-clock/

Best regards :hi:

#9 MedEvil

MedEvil

    Platinum Member

  • .script developer
  • 7771 posts

Posted 14 July 2012 - 04:28 PM

I don't quite understand, where's the difference between Windows own time service and your program?

:cheers:

#10 Max_Real Qnx

Max_Real Qnx

    Gold Member

  • Patrician
  • 1382 posts
  • Location:Istanbul
  • Interests:To be or not to be that is the question.
  •  
    Turkey

Posted 14 July 2012 - 04:58 PM

Hi MedEvil ;)

You have to do it with internet time feature of the windows by manual; the other is run with the command prompt. It's that simple. Did you not want such a thing already ? Or I figured out some of the things it wrong again ? Best regards :hi:

#11 pscEx

pscEx

    Platinum Member

  • Team Reboot
  • 12702 posts
  • Location:Korschenbroich, Germany
  • Interests:What somebody else cannot do.
  •  
    European Union

Posted 14 July 2012 - 05:33 PM

@Max: IMO your solution does not fullfill MedEvil's intention.

Imagine: He builds a laptop OS in Germany and travels with that laptop to Australia. There he has still time zone GMT+1, (depending on daylight saving maybe GMT).
His BIOS time is nearly correct.
After using your program the BIOS time is 99.99999 % correct.
No other change!

@Medevil: You can reset your laptop's system time to BIOS time (GMT) by

hostGrab.exe -ADTZ

but as long as your laptop does not have GPS, there is no real safe chance for a program to decide where in the world you are and to set the corresponding time zone data.
IMO ip-geo-locating is not fully trustable for correct information. See worldwide VPN, public proxies, etc. ...

Peter :cheers:

#12 MedEvil

MedEvil

    Platinum Member

  • .script developer
  • 7771 posts

Posted 14 July 2012 - 08:33 PM

IP-geo-locating is working good enough for detecting the correct timezone, given of course, no tunnel to an anonymous proxy, on the other end of the world, is used.

The problem is the way the timezone can be detected. So far i have only found a way, to get the offset to UTC/GMT not the timezone information itself.
Hence my question if this makes any difference to anyone. I presume that it only would affect the switching of daylightsaving time.

:cheers:

#13 pscEx

pscEx

    Platinum Member

  • Team Reboot
  • 12702 posts
  • Location:Korschenbroich, Germany
  • Interests:What somebody else cannot do.
  •  
    European Union

Posted 14 July 2012 - 09:04 PM

So far i have only found a way, to get the offset to UTC/GMT not the timezone information itself.

You exactly got the real issue:
Same GMT offsets have (rarelly, but there are some) different daylight saving offsets and switching dates.

Peter :cheers:

#14 MedEvil

MedEvil

    Platinum Member

  • .script developer
  • 7771 posts

Posted 14 July 2012 - 11:29 PM

I expect to see no DLS time near the equator and a reversed one on the southern hemisphere.

What would happen, if we don't set the timezone properly? Just the offset to GMT, but no DLST setting.
Then we would have no automatic switching while the PE is running, but would circumvent the problem of the constant DLST correction on every boot and the clock could easily be fixed by running the program again. :dubbio:

:cheers:

#15 pscEx

pscEx

    Platinum Member

  • Team Reboot
  • 12702 posts
  • Location:Korschenbroich, Germany
  • Interests:What somebody else cannot do.
  •  
    European Union

Posted 15 July 2012 - 07:30 AM

As ingenieer i prefer this way:
(I have a laptop with German time zone MEZ)
  • When building the PE, I copy the host's locale data to the build, using LocalizationEx.script.
  • Using BootTasks.script I tell the PE to grab the host's time zone on boot.
  • When I arrive in Australia, i once boot int standard Win and define the local time zone.'
    On every usage the PE has the local time zone defined.
  • When I'm back to Germany, I once define MEZ again.
    On every usage the PE has MEZ defined.
Peter

#16 MedEvil

MedEvil

    Platinum Member

  • .script developer
  • 7771 posts

Posted 15 July 2012 - 05:42 PM

And i believe, that computers are there, so they can do things automaticaly. Else we could just use tapewriters. ;)

:cheers:




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users