I'm modifying the time zone by replacing the file /etc/locatime by one in /usr/share/zoneinfo in a C#/Mono application, it nearly works.
Here is my code:
Console.WriteLine("a) Current Time zone: {0}", TimeZoneInfo.Local.StandardName);
Console.WriteLine("a) Now: {0}", DateTime.Now);
// Changing /etc/locatime from CET to PST ...
TimeZoneInfo.ClearCachedData();
Console.WriteLine("b) Current Time zone: {0}", TimeZoneInfo.Local.StandardName);
Console.WriteLine("b) Now: {0}", DateTime.Now);
And here is the ouput:
a) Current Time zone: CET
a) Now: 10/20/2012 2:00:26 PM
b) Current Time zone: PST
b) Now: 10/20/2012 2:00:26 PM
As you can see the time zone is correct but DateTime.Now, which should return the local time, doesn't work and returns twice the same value.
Here is the version of mono I'm using:
user@ubuntu:~$ mono -V
Mono JIT compiler version 2.10.8.1 (Debian 2.10.8.1-1ubuntu2.2)
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: x86
Disabled: none
Misc: softdebug
LLVM: supported, not enabled.
GC: Included Boehm (with typed GC and Parallel Mark)
Does someone have an idea about this issue?