Page 1 of 1 1
Topic Options
#193807 - 2009-05-13 06:33 AM about Sync Time (include timezone setting)
huangwl Offline
Fresh Scripter

Registered: 2009-03-13
Posts: 7
Loc: China
Is there a method can synchronize time and timezone setting from logon server?

I hope the time will be synchronized to local time when user logon in other site with different timezone.

Could we dicuss about this?

I try to writevalue for "activetimeBias" and "Bias" in registry.(HKLM\System\CurrentControlSet\Control\TimeZoneInformation\).
But It doesn't work.

Top
#193808 - 2009-05-13 08:41 AM Re: about Sync Time (include timezone setting) [Re: huangwl]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11629
Loc: CA
Unless you're still on NT 4 Server Domain this is already automatically handled by Active Directory.

Please provide more details on your issue and concerns.

Top
#193819 - 2009-05-13 02:07 PM Re: about Sync Time (include timezone setting) [Re: NTDOC]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4402
Loc: New Jersey
If I'm understanding the question, I don't believe that's possible. Time is relative to the computer location, not the user location. Thus, if you have a computer in China and a user in the UK, the user in the UK will (should) see UK time on their local PC, but will see China time if they RDP to the computer in China.

Time sync is usually done via GMT/UCT, and then the offset of the local computer is applied to that to get the local time. If the PC in the UK was a member of the domain in China, standard A-D time sync should work and keep the clocks aligned, yet display the respective local time.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#193823 - 2009-05-13 03:01 PM Re: about Sync Time (include timezone setting) [Re: Glenn Barnas]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
So, if you are a UK user and you take your laptop to China becuase you are working out there for a couple of weeks would you not want the timezone to update to reflect local time?
Top
#193824 - 2009-05-13 04:34 PM Re: about Sync Time (include timezone setting) [Re: Richard H.]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4402
Loc: New Jersey
The request was for when a user logged on at a different site in a different time zone. Changing my local time zone might make sense (to me) only if my laptop was going to spend a fair amount of time in China..

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#193827 - 2009-05-13 05:09 PM Re: about Sync Time (include timezone setting) [Re: Glenn Barnas]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Too many differents there for me
Top
#193832 - 2009-05-14 06:35 AM Re: about Sync Time (include timezone setting) [Re: Glenn Barnas]
huangwl Offline
Fresh Scripter

Registered: 2009-03-13
Posts: 7
Loc: China
thank all for your reply.

In my case.
Some user have business trip between two branch with 1HR different time zone. They often think the time in PC is local time when they in business trip. this cause they miss some appointment.
I know the user had the sense of different timezone is more important. But as a engineer, I try to find whether is there a solution can be applianced for this case.
Yesterday, Microsoft support give me a reply that it is hard to do that. I thaught perhaps I need to end this idea.

Top
#193834 - 2009-05-14 07:48 AM Re: about Sync Time (include timezone setting) [Re: huangwl]
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
If your systems are set correctly they should be in the proper time zone. If you are running anything from 2K and up, they will sync with your DC's and adjust their time accordingly.

Make sure the local PC's are set for the correct time zones and get your DC's talking to an authoritative NTP server (at least a Stratum 2).

This should fix your problems and when users log in, their outlook reminders (assuming of course you are using outlook), will adjust to the current time zone.
_________________________
Today is the tomorrow you worried about yesterday.

Top
#193850 - 2009-05-14 02:54 PM Re: about Sync Time (include timezone setting) [Re: Gargoyle]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4402
Loc: New Jersey
Hmm.. don't think so.. NTP and NT5DS protocols don't deal with time zones, just time. My laptop is set for EST/EDT, but if I travel to our site in Australia and sync with the local DC there, it will still display EST/EDT time (and quite accurately, too, since I'm syncing to a local authoritative time source!) We have a highly accurate time environment here, using NTP on all servers and the PDCe, NT5DS on the other DCs and workstations. Our retail locations throughout all of North America sync to DCs in the NYC metro area, and all have locally defined timezone settings.

Now that the OP has clarified that it is a travelling laptop that needs to adjust to a different, local time zone, the challenge becomes clear. You need to have some way to identify that the network location is a different time zone.

You can't simply query the DC because the site you're at might not have one, or you could authenticate to your "home" DC.

AD Sites might work, but they might not be configured, or might span a timezone border. Subnets, however would rarely (ok, prolly never!) cross a timezone border. (imagine the grief of a business office split by a time zone! \:D )

So, assuming that you could create a translation between subnet ranges and timezones, you could potentially update the timezone setting during logon. However, since timezone is a machine and not a user setting, I'm thinking that it won't be as simple as plugging values into the registry. Might need a reboot or minimally a restart of the W32time service - not sure. Of course, if those actions are needed, the code would have to be smart enough to trigger them only if it actually changed the timezone value.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#193858 - 2009-05-14 03:29 PM Re: about Sync Time (include timezone setting) [Re: Glenn Barnas]
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
 Quote:
Now that the OP has clarified that it is a travelling laptop that needs to adjust to a different, local time zone, the challenge becomes clear. You need to have some way to identify that the network location is a different time zone.


You are correct, somehow I missed the part about the traveling laptops. And since TZ are machine set, they would have to be updated everytime.

I see an UDF in the near future...
_________________________
Today is the tomorrow you worried about yesterday.

Top
#193869 - 2009-05-14 04:21 PM Re: about Sync Time (include timezone setting) [Re: Gargoyle]
BradV Offline
Seasoned Scripter
****

Registered: 2006-08-16
Posts: 687
Loc: Maryland, USA
Or try to educate users that their laptop is always going to display time in the "home" time zone.

Argh, not sure what I was thinking. That will never work. \:\)

Top
#193886 - 2009-05-15 12:35 AM Re: about Sync Time (include timezone setting) [Re: BradV]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4567
Loc: USA
For what it's worth here is a quote from another page on how to change it on XP/2k. I've read this no longer works with Vista and can confirm it does not work on Win 7.

 Quote:

Control.exe TIMEDATE.CPL,,/Z (GMT-08:00) Pacific Time (US & Canada); Tijuana

alternatively:
RUNDLL32.EXE SHELL32.DLL,Control_RunDLL TIMEDATE.CPL,,/Z (GMT-08:00) Pacific
Time (US & Canada); Tijuana

where '(GMT-08:00) Pacific Time (US & Canada); Tijuana' is the timezone to be
set.

Input value behind /Z is from the Display value under the registry key
'HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones'

You can use the Std value in those registry keys as well, this is equivalent
with "(GMT-08:00) Pacific Time (US & Canada); Tijuana":

Control.exe TIMEDATE.CPL,,/Z Pacific Standard Time

Top
#193904 - 2009-05-15 08:59 PM Re: about Sync Time (include timezone setting) [Re: Allen]
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Don't know if it is too late to come into the party or not..

However, this is from a friend of mine who I worked with pretty extensively to get time synchronization working properly in the domain we working with..

 Quote:

each windows PDC emulator is the domains time server. If the domains are all in the same forest, you just need to sync the root domains PFC with an atomic external time source. If domains are in separate forests (dmz domain for ex) each PDC emulator needs to be set to look the same set of external atomic clocks. off the top of my head, I use these two in my pool of 5 or so.

Time-a.nist.gov
Time-b.nist.gov

On your PDC run the following:

net time /setsntp time-a.nist.gov time-b.nist.gov

You need to make sure udp port 123 is allowed outbound from PDC.

all other servers, workstations should have windows time service started.

If you run the following query on a box having trouble and see it set to windows.Time.com or maybe time.windows.com you need to reset it to use domain time. Run the same as above with NO time source:

net time /setsntp

an invaluable reskit tool to check domain time is w32tm. Run

W32tm /monitor

Lastly, if running VMWare esx , you need to make sure all host esx servers are setup to sync to the same external tim servers as your windows boxes, using their NTP.conf file. Make sure all vm's are running the latest VM tools and set the tools to sync their time with the esx host. I believe you also stop the windows time service so they do not compete but I'd have to verify. This is true for all VM's but the pdc emulator if running it in a VM. It will not sync with the esx host and should be setup exactly as stated above. Good luck. Let me know.

Good chatting with you


HTH,

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#193905 - 2009-05-15 09:20 PM Re: about Sync Time (include timezone setting) [Re: Kdyer]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4567
Loc: USA
Hey Kent...

Maybe I am missing it, but how does this address time zone changes?

Top
#193906 - 2009-05-15 10:32 PM Re: about Sync Time (include timezone setting) [Re: Allen]
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
If it is going against the atomic clock and you have sntp services setup correctly, the tz should be set correctly..

Other than that, you are correct..

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#193907 - 2009-05-15 11:16 PM Re: about Sync Time (include timezone setting) [Re: Kdyer]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4402
Loc: New Jersey
No - TZ is not set by NTP and it's derivatives.. that's the whole point of this discussion.. The user must change the TZ where the system exists, which will then sync time to GMT and adjust the display of the time based on the TZ that was selected.

G-
_________________________
Actually I am a Rocket Scientist! \:D

Top
#193908 - 2009-05-16 12:23 AM Re: about Sync Time (include timezone setting) [Re: Glenn Barnas]
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
My apologies.

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#193909 - 2009-05-16 12:38 AM Re: about Sync Time (include timezone setting) [Re: Kdyer]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4567
Loc: USA
No apologies needed bud. None of us are getting paid to do this you know ;\)

I think AutoIT can do it though...

 Code:
; #FUNCTION# ====================================================================================================================
; Name...........: _Date_Time_SetTimeZoneInformation
; Description ...: Sets the current time zone settings
; Syntax.........: _Date_Time_SetTimeZoneInformation($iBias, $sStdName, $tStdDate, $iStdBias, $sDayName, $tDayDate, $iDayBias)
; Parameters ....: $iBias       - The current bias for local time translation on this computer.  The bias is the difference in
;                  +minutes between Coordinated Universal Time (UTC) and local time.  All translations between UTC and local time
;                  +use the following formula: UTC = local time + bias
;                  $sStdName    - The description for standard time
;                  $tStdDate    - A %tagSYSTEMTIME structure that contains a date and local time when the transition from
;                  +daylight saving time to standard time occurs.
;                  $iStdBias    - The bias value to be used during local time translations that occur during standard time.  This
;                  +value is added to the value of the Bias to form the bias used during standard time.  In most time zones, this
;                  +value is zero.
;                  $sDayName    - The description for daylight saving time
;                  $tDayDate    - A %tagSYSTEMTIME structure that contains a date and local time when the transition from
;                  +standard time to daylight saving time occurs.
;                  $iDayBias    - The bias value to be used during local time translation that occur during daylight saving time.
;                  +This value is added to the value of the Bias member to form the bias used during daylight saving time.  In
;                  +most time zones this value is –60.
; Return values .: Success      - True
;                  Failure      - False
; Author ........: Paul Campbell (PaulIA)
; Modified.......: Gary Frost (gafrost)
; Remarks .......:
; Related .......: _Date_Time_GetTimeZoneInformation, $tagSYSTEMTIME
; Link ..........;
; Example .......; Yes
; ===============================================================================================================================
Func _Date_Time_SetTimeZoneInformation($iBias, $sStdName, $tStdDate, $iStdBias, $sDayName, $tDayDate, $iDayBias)
	Local $hToken, $tStdName, $tDayName, $tZoneInfo, $aResult

	$tStdName = _WinAPI_MultiByteToWideChar($sStdName)
	$tDayName = _WinAPI_MultiByteToWideChar($sDayName)
	$tZoneInfo = DllStructCreate($tagTIME_ZONE_INFORMATION)
	DllStructSetData($tZoneInfo, "Bias", $iBias)
	DllStructSetData($tZoneInfo, "StdName", DllStructGetData($tStdName, 1))
	_MemMoveMemory(DllStructGetPtr($tStdDate), DllStructGetPtr($tZoneInfo, "StdDate"), DllStructGetSize($tStdDate))
	DllStructSetData($tZoneInfo, "StdBias", $iStdBias)
	DllStructSetData($tZoneInfo, "DayName", DllStructGetData($tDayName, 1))
	_MemMoveMemory(DllStructGetPtr($tDayDate), DllStructGetPtr($tZoneInfo, "DayDate"), DllStructGetSize($tDayDate))
	DllStructSetData($tZoneInfo, "DayBias", $iDayBias)

	; Enable system time privileged mode
	$hToken = _Security__OpenThreadTokenEx(BitOR($__DATECONSTANT_TOKEN_ADJUST_PRIVILEGES, $__DATECONSTANT_TOKEN_QUERY))
	_WinAPI_Check("_Date_Time_SetSystemTimeAjustment:OpenThreadTokenEx", @error, @extended)
	_Security__SetPrivilege($hToken, "SeSystemtimePrivilege", True)
	_WinAPI_Check("_Date_Time_SetSystemTimeAjustment:SetPrivilege:Enable", @error, @extended)

	; Set time zone information
	$aResult = DllCall("Kernel32.dll", "int", "SetTimeZoneInformation", "ptr", DllStructGetPtr($tZoneInfo))

	; Disable system time privileged mode
	_Security__SetPrivilege($hToken, "SeSystemtimePrivilege", False)
	_WinAPI_Check("_Date_Time_SetSystemTimeAdjustment:SetPrivilege:Disable", @error, @extended)
	_WinAPI_CloseHandle($hToken)

	Return SetError($aResult[0] = 0, 0, $aResult[0] <> 0)
EndFunc   ;==>_Date_Time_SetTimeZoneInformation


Maybe? If so, it just another time when I absolutely hate it when our "competition" can do something we can't.

Top
#193910 - 2009-05-16 01:02 AM Re: about Sync Time (include timezone setting) [Re: Allen]
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
But you still have to supply it all of the information. We can do that in KiX, nothing superfancy either, could always just shell out and set it if needed.
_________________________
Today is the tomorrow you worried about yesterday.

Top
#194329 - 2009-06-20 10:25 AM Re: about Sync Time (include timezone setting) [Re: Gargoyle]
huangwl Offline
Fresh Scripter

Registered: 2009-03-13
Posts: 7
Loc: China
Long time no visit this forum.

So nice that so many guys join this topic.

Thanks allen, your point is useful for me, but I still need to find a way to know logonserver's time zone name. then use control.exe to chage local PC's timezone.

thanks other guys. I will try your script later.

I like this community. thanks all.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1376 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.086 seconds in which 0.036 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org