Re: RE : [fpc-devel] Problem with Now() and time changed by ntpd
On Thursday 03 of November 2011 21:30:19 Sven Barth wrote: Am 02.11.2011 19:25, schrieb Ludo Brands: Apparently not everything is that transparent under windows: http://msdn.microsoft.com/en-us/library/windows/desktop/ms724944%28v=vs.8 5%2 9.aspx To inform Explorer that the time zone has changed, send the WM_SETTINGCHANGE message. WM_SETTINGCHANGE simply notifies you that the user changed the time zone, because otherwise you might not be able to detect that (except you read the settings from the registry yourself). Or: http://channel9.msdn.com/coding4fun/articles/Changing-time-zones By itself, changing the time zone doesn't have any apparent effect except in new processes. In order to see the change, you need to send a system notification message. This notification is made by calling SendMessageTimeout with WM_SettingChange and a parameter of intl. This is wrong. Changing the timezone effects e.g. all following calls to GetLocalTime. See the following example program: === source begin === program timezonetest; {$apptype console} {$mode objfpc}{$H+} uses SysUtils; begin Writeln(FormatDateTime('c', Now)); Writeln('Please change the timezone and then press enter'); Readln; Writeln(FormatDateTime('c', Now)); Writeln('Done'); Readln; end. === source end === As you see there is no message processing. My normal timezone is Berlin. Now I've run the program and changed the timezone to Greenland (-3h). The output was the following: === output begin === 03.11.2011 21:16:33 Please change the timezone and then press enter 03.11.2011 17:17:10 Done === output end === So your link which talks about only affects new processes is proven wrong. But this is on windows ? On linux it does not work without re-reading tzdata. zeljko ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: RE : [fpc-devel] Problem with Now() and time changed by ntpd
Am 04.11.2011 07:55, schrieb zeljko: But this is on windows ? On linux it does not work without re-reading tzdata. Yes, this is Windows only. It was meant as a prove that a timezone change does influence running processes as well (and not only new ones as that link stated). Regards, Sven ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: RE : [fpc-devel] Problem with Now() and time changed by ntpd
Am 02.11.2011 19:25, schrieb Ludo Brands: Apparently not everything is that transparent under windows: http://msdn.microsoft.com/en-us/library/windows/desktop/ms724944%28v=vs.85%2 9.aspx To inform Explorer that the time zone has changed, send the WM_SETTINGCHANGE message. WM_SETTINGCHANGE simply notifies you that the user changed the time zone, because otherwise you might not be able to detect that (except you read the settings from the registry yourself). Or: http://channel9.msdn.com/coding4fun/articles/Changing-time-zones By itself, changing the time zone doesn't have any apparent effect except in new processes. In order to see the change, you need to send a system notification message. This notification is made by calling SendMessageTimeout with WM_SettingChange and a parameter of intl. This is wrong. Changing the timezone effects e.g. all following calls to GetLocalTime. See the following example program: === source begin === program timezonetest; {$apptype console} {$mode objfpc}{$H+} uses SysUtils; begin Writeln(FormatDateTime('c', Now)); Writeln('Please change the timezone and then press enter'); Readln; Writeln(FormatDateTime('c', Now)); Writeln('Done'); Readln; end. === source end === As you see there is no message processing. My normal timezone is Berlin. Now I've run the program and changed the timezone to Greenland (-3h). The output was the following: === output begin === 03.11.2011 21:16:33 Please change the timezone and then press enter 03.11.2011 17:17:10 Done === output end === So your link which talks about only affects new processes is proven wrong. Regards, Sven ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: RE : [fpc-devel] Problem with Now() and time changed by ntpd
Ludo Brands schrieb: debated). Also note that on platforms like Windows this would be a unnecessary call as there the current(!) timezone bias is located in a shared memory area which is mapped into each process by the kernel. Apparently not everything is that transparent under windows: http://msdn.microsoft.com/en-us/library/windows/desktop/ms724944%28v=vs.85%2 9.aspx To inform Explorer that the time zone has changed, send the WM_SETTINGCHANGE message. Or: http://channel9.msdn.com/coding4fun/articles/Changing-time-zones By itself, changing the time zone doesn't have any apparent effect except in new processes. In order to see the change, you need to send a system notification message. This notification is made by calling SendMessageTimeout with WM_SettingChange and a parameter of intl. There exists a more specific WM_TIMECHANGE message, with the remark: An application should not broadcast this message, because the system will broadcast this message when the application changes the system time. It remains unclear whether a DST change will cause such an broadcast as well. Most probably *not*, because the system time (UTC) is not affected by DST or timezone changes. DoDi ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel