Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DateTime.Now or Timezone information do not transition out of DST for all time zones #9664

Closed
jbatt33 opened this issue Jul 20, 2018 · 20 comments · Fixed by #15401, #15548 or xamarin/xamarin-android#3392
Assignees

Comments

@jbatt33
Copy link

@jbatt33 jbatt33 commented Jul 20, 2018

Note

Using Vatican time zone as an example.

Steps to Reproduce

  1. Turn off NTP time synchronization for linux

sudo timedatectl set-ntp off

  1. Turn off any other network time synchronization services that may be active
  2. Set the time zone on the server to the Vatican time zone

sudo timedatectl set-timezone Europe/Vatican

  1. Set the time of the OS to 1 hour and 1 minute before the reported DST Exit datetime of 10/28/2018 3:00:00 AM

sudo date 102801592018.00

  1. Run a mono application that prints the time.
  2. Wait for an 1 hour and compare the application's time to the OS's time

Current Behavior

The mono application will not transition out of DST for two hours past DST exit.

OS Linux Run Output

$ date
Sun Oct 28 02:59:55 CEST 2018

$ date
Sun Oct 28 02:59:57 CEST 2018

$ date
Sun Oct 28 02:00:00 CET 2018 << System Time correctly drops out of DST

$ date
Sun Oct 28 02:00:02 CET 2018 

Mono application run:

Before transition

-----------------------------------------------
DateTime.Now: 10/28/2018 2:59:58 AM
Cleared: DateTime.Now: 10/28/2018 2:59:58 AM
UTC+Offset: 10/28/2018 2:59:58 AM
636762923986794550 - Start: 3/25/2018 2:00:00 AM:636575400000000000 - End: 10/28/2018 3:00:00 AM:636762924000000000 - True
In DST
UTC: 10/28/2018 00:59:58 - Offset: 02:00:00
-----------------------------------------------

After transition

-----------------------------------------------
DateTime.Now: 10/28/2018 3:00:03 AM
Cleared: DateTime.Now: 10/28/2018 3:00:03 AM
UTC+Offset: 10/28/2018 3:00:03 AM
636762924036831780 - Start: 3/25/2018 2:00:00 AM:636575400000000000 - End: 10/28/2018 3:00:00 AM:636762924000000000 - True
Not in DST
UTC: 10/28/2018 01:00:03 - Offset: 02:00:00
-----------------------------------------------

The current time is still reporting that we are in DST. 3AM instead of 2AM The print "Not in DST" is from the application calculating that we have exited DST based on the ticks of the system.

If the application is allowed to run for another hour, mono will partially transition.

The UTC+Offset calculation will be correct, but the DateTime.Now will still return the incorrect information.

-----------------------------------------------
DateTime.Now: 10/28/2018 4:14:01 AM
Cleared: DateTime.Now: 10/28/2018 4:14:01 AM
UTC+Offset: 10/28/2018 3:14:01 AM
636762968419149760 - Start: 3/25/2018 2:00:00 AM:636575400000000000 - End: 10/28/2018 3:00:00 AM:636762924000000000 - False
Not in DST
UTC: 10/28/2018 02:14:01 - Offset: 01:00:00
-----------------------------------------------

Waiting one more hour, the mono application's DateTime.Now will be in sync with the system time

-----------------------------------------------
DateTime.Now: 10/28/2018 4:18:39 AM 
Cleared: DateTime.Now: 10/28/2018 4:18:39 AM
UTC+Offset: 10/28/2018 4:18:39 AM
636762971197489090 - Start: 3/25/2018 2:00:00 AM:636575400000000000 - End: 10/28/2018 3:00:00 AM:636762924000000000 - False
Not in DST
UTC: 10/28/2018 03:18:39 - Offset: 01:00:00
-----------------------------------------------

Platforms

Ubuntu 16.04.4 LTS

Mono JIT compiler version 5.4.0.201 (tarball Tue Mar 13 14:55:42 UTC 2018)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       altstack
        Notifications: epoll
        Architecture:  x86
        Disabled:      profiler
        Misc:          softdebug
        LLVM:          supported, not enabled.
        GC:            sgen (concurrent by default)

Mono application's code

using System;
using System.Globalization;
using System.Threading;

namespace NowTest
{
    class Program
    {
        static void Main(string[] args)
        {
            //run forever
            while (true)
            {
                Console.WriteLine("-----------------------------------------------");
                //Print some DateTime.Net information
                Console.WriteLine("DateTime.Now: {0}", DateTime.Now);
                CultureInfo.CurrentCulture.ClearCachedData();
                Console.WriteLine("Cleared: DateTime.Now: {0}", DateTime.Now);
                Console.WriteLine("UTC+Offset: {0}", GetLocalTime());
                
                var currTimeZone = TimeZone.CurrentTimeZone;
                var now = DateTime.Now;
                var dstInfo = currTimeZone.GetDaylightChanges(now.Year);
                var inDST = currTimeZone.IsDaylightSavingTime(now);
                var offset = currTimeZone.GetUtcOffset(now);
                var utcDateTime = DateTime.UtcNow;

                //Print some more information for fun
                Console.WriteLine("{0} - Start: {1}:{2} - End: {3}:{4} - {5}", now.Ticks, dstInfo.Start, dstInfo.Start.Ticks, dstInfo.End, dstInfo.End.Ticks, inDST);
                
                //If I do the match for the ticks, let's see if we are following everything correctly
                if (now.Ticks > dstInfo.Start.Ticks)
                {
                    Console.WriteLine(now.Ticks > dstInfo.End.Ticks ? "Not in DST" : "In DST");
                }

                Console.WriteLine("UTC: {0} - Offset: {1}", utcDateTime.ToString(CultureInfo.InvariantCulture), offset.ToString());
                Console.WriteLine("-----------------------------------------------{0}", Environment.NewLine);
                //Print every 5 seconds for kicks
                Thread.Sleep(5000);
            }
            
        }

        //return the local time using UTC offset and UTC Now
        static DateTime GetLocalTime()
        {
            //Try to clear the cache and see if that helps...
            System.Globalization.CultureInfo.CurrentCulture.ClearCachedData();
            return (DateTime.UtcNow + TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now));
        }
    }
}
@lewurm lewurm added this to Bugs Pool in Bugs Week via automation Jul 23, 2018
@marek-safar

This comment has been minimized.

Copy link
Member

@marek-safar marek-safar commented Nov 1, 2018

/cc @EgorBo

@jgold6

This comment has been minimized.

Copy link

@jgold6 jgold6 commented Mar 13, 2019

I have another report of this issue. IN this case it caused a serious problem with an app. This past March 9, in CST, the customer's app, which is using DateTime.Now for times, jumped from 7:59 PM to 9:00 PK, seemingly going to CDT (Central Daylight Time) 6 hours early. Doing some more testing I found the following (did not test all time zones):

In Central ST, time jumped from 3/9 7:59 PM to 9:00 PM.
So between 3/9 8:00 PM CST and 3/10 2:00 AM CST, DateTime.Now shows 1 hour ahead of actual.

In Eastern ST, as expected.

In Mountain ST, as expected

In Pacific ST, as expected

in Alaska ST, time jumped from 3/9 4:59 PM to 6:00 PM
So between 3/9 5:00 PM AST and 3/10 2:00 AM AST, DateTime.Now shows 1 hour ahead of actual.

Atlantic ST as expected

Azores ST (Portugal), time jumps from 3/30 10:59 PM to 3/31 12:00 AM.
So between 3/30 11:00 PM Azores ST and 3/31 12:00 AM Azores ST, DateTime.Now shows 1 hour ahead of actual.

Those are all I tested so far

To reproduce:

  1. Create a Mono Console app and write DateTime.Now to the console
  2. Set your system time to Central Standard time March 9 at 9 PM.
  3. Run the console app

Expected result: Time printed to console should match the system time in the Mac menu bar (or system time of the linux computer)

Actual result: Time printed to console is 1 hour ahead of the system time

Mono version:

Mono 5.16.0.238 (2018-06/99d74f7f6ee) (64-bit)
Package version: 516000238

@marek-safar marek-safar removed this from Bugs Pool in Bugs Week Mar 13, 2019
@EgorBo

This comment has been minimized.

Copy link
Member

@EgorBo EgorBo commented Mar 13, 2019

@jbatt33 I can reproduce it on 5.4.0.201 but can't do it on 6.1.x (master) I guess it was fixed by #11500 or #11232

@jgold6

This comment has been minimized.

Copy link

@jgold6 jgold6 commented Mar 14, 2019

After going through the list of countries in this wikipedia page on DST,, these are the areas I found that showed the issue:

Central ST US (Central time Canada seems to be OK)
Alaska ST
Portugal (Azores ST)
Cuba (Cuba ST)
Turks and Caicos (Eastern ST)

List of all locales I tested

In Central ST, time jumped from 3/9 7:59 PM to 9:00 PM.
So between 3/9 8:00 PM CST and 3/10 2:00 AM CST, DateTime.Now shows 1 hour ahead of actual.

In Eastern ST, as expected.

In Mountain ST, as expected, even Arizona that does not observe DST is correct.

In Pacific ST, as expected

In Alaska ST, time jumped from 3/9 4:59 PM to 6:00 PM
So between 3/9 5:00 PM AST and 3/10 2:00 AM AST, DateTime.Now shows 1 hour ahead of actual.

Atlantic ST as expected

Azores ST (Portugal), time jumps from 3/30 10:59 PM to 3/31 12:00 AM.
So between 3/30 11:00 PM Azores ST and 3/31 12:00 AM Azores ST, DateTime.Now shows 1 hour ahead of actual.

Now testing by locations in the Wikipedia DST list:

Bahamas (Eastern): as expected

Bermuda (Atlantic): as expected

Canada, Vancouver (Pacific): as expected

Canada, Calgary (mountain): as expected

Canada, Saskatoon Saskatchewan (Central): as expected (Saskatchewan does not observe DST)

Canada, Winnipeg Manitoba (Central): as expected. (note that US Central has the error.)

Canada, Toronto (Eastern): as expected

Canada, Halifax (Atlantic): as expected

Cuba, Havana (Cuba Standard Time): time jumps from 3/9 6:59 PM to 8:00 PM. So between 3/9 7:00 PM and 3/10 12:00 AM, DateTime.Now shows 1 hour ahead of actual. (Cuba switches at midnight on second Sunday in March)

Haiti, Port-au-Prince (Eastern): as expected

Saint Pierre and Miquelon: cannot find in macOS time zone settings

Turks and Caicos (Eastern): time jumps from 3/9 8:59 PM to 10:00 PM. So between 3/9 9:00 PM and 3/10 2:00 AM, DateTime.Now shows 1 hour ahead of actual.

United States: see above for Eastern, Central, Mountain, Pacific, and Alaska.

Iran, Tehran (Iran ST): as expected (change on March 22 at 12:00 AM)

Israel, Jerusalem (Israel ST): as expected

Jordan, Amman (Eastern European ST): as expected (change on 3/29 at 12:00 AM)

Syria, Damascus (Eastern European ST): as expected (change on 3/29 at 12:00 AM)

Greenland, Nuuk (West Greenland ST): as expected (change on 3/30 at 10:00 PM)

Albania, Tirana (Central European ST): as expected (change on 3/31 at 2:00 AM)

Andorra, Andorra la Vella (Central European ST): as expected (change on 3/31 at 2:00 AM)

Austria, Vienna (Central European ST): as expected (change on 3/31 at 1:00 AM UTC (2:00 AM local))

Belgium, Brussels (Central European ST): as expected (change on 3/31 at 1:00 AM UTC (2:00 AM local))

Bosnia & Herzegovina, Sarajevo (Central European ST): as expected (change on 3/31 at 1:00 AM UTC (2:00 AM local))

Bulgaria, Sofia (Eastern European ST): as expected (change on 3/31 at 1:00 AM UTC (3:00 AM local))

Croatia, Zagreb (Central European ST): as expected (change on 3/31 at 1:00 AM UTC (2:00 AM local))

Cyprus, Nicosia (Eastern European ST): as expected (change on 3/31 at 1:00 AM UTC (3:00 AM local))

Czechia, Prague (Central European ST): as expected (change on 3/31 at 1:00 AM UTC (2:00 AM local))

Denmark, Copenhagen (Central European ST): as expected (change on 3/31 at 1:00 AM UTC (2:00 AM local))

Estonia, Tallinn (Eastern European ST): as expected (change on 3/31 at 1:00 AM UTC (3:00 AM local))

Faroe Islands, Thorshavn (Western European ST): as expected (change on 3/31 at 1:00 AM UTC (1:00 AM local))

Finland, Helsinki (Eastern European ST): as expected (change on 3/31 at 1:00 AM UTC (3:00 AM local))

France, Paris (Central European ST): as expected (change on 3/31 at 1:00 AM UTC (2:00 AM local))

Germany, Berlin (Central European ST): as expected (change on 3/31 at 1:00 AM UTC (2:00 AM local))

Greece, Athens (Eastern European ST): as expected (change on 3/31 at 1:00 AM UTC (3:00 AM local))

Guernsey (UK): cannot find in macOS time zone settings

testing all areas noted in Wikipedia DST article (https://en.wikipedia.org/wiki/Daylight_saving_time_by_country) continued...

Holy See, Vatican City (Central European ST): as expected (change on 3/31 at 1:00 AM UTC (2:00 AM local))

Hungary, Budapest (Central European ST): as expected (change on 3/31 at 1:00 AM UTC (2:00 AM local))

UK, Douglas, Isle of Man (GMT+1:00): as expected (change on 3/31 at 1:00 AM UTC (1:00 AM local))

Italy, Rome (Central European ST): as expected (change on 3/31 at 1:00 AM UTC (2:00 AM local))

Jersey (UK): cannot find in macOS time zone settings

Kosovo, Pristina (Central European ST): as expected (change on 3/31 at 1:00 AM UTC (2:00 AM local))

Latvia, Riga (Eastern European ST): as expected (change on 3/31 at 1:00 AM UTC (3:00 AM local))

Lebanon, Beirut (Eastern European ST): as expected (change on 3/31 at 12:00 AM local)

Liechtenstein, Vaduz (Central European ST): as expected (change on 3/31 at 2:00 AM local)

Lithuania, Vilnius (Eastern European ST): as expected (change on 3/31 at 1:00 AM UTC (3:00 AM local))

Luxembourg, Luxembourg (Central European ST): as expected (change on 3/31 at 1:00 AM UTC (2:00 AM local))

Malta, Valletta (Central European ST): as expected (change on 3/31 at 1:00 AM UTC (2:00 AM local))

Moldova, Chişinău (Eastern European ST): as expected (change on 3/31 at 2:00 AM local)

Monaco, Monaco (Eastern European ST): as expected (change on 3/31 at 2:00 AM local)

Montenegro, Podgorica (Central European ST): as expected (change on 3/31 at 2:00 AM local)

Netherlands, Amsterdam (Central European ST): as expected (change on 3/31 at 2:00 AM local)

Macedonia, Skopje (Central European ST): as expected (change on 3/31 at 2:00 AM local)

Norway, Oslo (Central European ST): as expected (change on 3/31 at 1:00 AM UTC (2:00 AM local))

Poland, Warsaw (Central European ST): as expected (change on 3/31 at 1:00 AM UTC (2:00 AM local))

Portugal, Lisbon (Western European ST): as expected (change on 3/31 at 1:00 AM UTC (1:00 AM local))

Portugal, Ponta Delgada (Azores ST) time jumps from 3/30 10:59 PM to 3/31 12:00 AM. So between 3/30 11:00 PM Azores ST and 3/31 12:00 AM Azores ST, DateTime.Now shows 1 hour ahead of actual.

Romania, Bucharest (Eastern European ST): as expected (change on 3/31 at 1:00 AM UTC (3:00 AM local))

San Marino, San Marino (Central European ST): as expected (change on 3/31 at 2:00 AM local)

Serbia, Belgrade (Central European ST): as expected (change on 3/31 at 1:00 AM UTC (2:00 AM local))

Slovakia, Bratislava (Central European ST): as expected (change on 3/31 at 1:00 AM UTC (2:00 AM local))

Slovenia, Ljubljana (Central European ST): as expected (change on 3/31 at 1:00 AM UTC (2:00 AM local))

Spain, Madrid (Central European ST): as expected (change on 3/31 at 1:00 AM UTC (2:00 AM local))

Sweden, Stockholm (Central European ST): as expected (change on 3/31 at 1:00 AM UTC (2:00 AM local))

Switzerland, Berne (Central European ST): as expected (change on 3/31 at 1:00 AM UTC (2:00 AM local))

Ukraine, Kiev (Eastern European ST): as expected (change on 3/31 at 1:00 AM UTC (3:00 AM local))

United Kingdom, London (British ST): as expected (change on 3/31 at 1:00 AM local)

Mexico, Mexico City (Central ST): as expected (change on 4/7 at 2:00 AM local)


SOUTHERN HEMISPHERE - SPRING BACK:

Chile, Santiago (Chile ST): as expected (change on 4/7 at 12:00 AM (goes back one hour to 11:00 PM 4/6)

New Zealand, Wellington (New Zealand ST): as expected (change on 4/7 at 3:00 AM (goes back one hour to 2:00 AM)

Samoa, Apia (Apia ST): as expected (change on 4/7 at 4:00 AM (goes back one hour to 3:00 AM)

Australia - DST used only in Australian Capital Territory, Jervis Bay Territory, New South Wales, Victoria, Tasmania, South Australia

Australian Capital Territory, Canberra (Australian Eastern ST): as expected (change on 4/7 at 3:00 AM (goes back one hour to 2:00 AM)

New South Wales, Sydney (Australian Eastern ST): as expected (change on 4/7 at 3:00 AM (goes back one hour to 2:00 AM)

Victoria, Melbourne (Australian Eastern ST): as expected (change on 4/7 at 3:00 AM (goes back one hour to 2:00 AM)

Tasmania, Hobart (Australian Eastern ST): as expected (change on 4/7 at 3:00 AM (goes back one hour to 2:00 AM)

South Australia, Adelaide (Australian Central ST): as expected (change on 4/7 at 3:00 AM (goes back one hour to 2:00 AM)

Paraguay, Asunción (Paraguay ST): as expected (change on 3/24 at 12:00 AM (goes back one hour to 3/23 11:00 PM)

Brazil - https://en.wikipedia.org/wiki/Daylight_saving_time_in_Brazil - DST end delays one week during Carnival week. Only these south and central states use DST: São Paulo, Rio de Janeiro, Federal District Brasilia, Santa Catarina, Paraná, Goiás, Rio Grande do Sul, Mato Grosso do Sul, Espírito Santo, Minas Gerais and Mato Grosso (some exceptions).

São Paulo, São Paulo (Brasilia ST): as expected (change on 2/17 at 12:00 AM (goes back one hour to 2/16 11:00 PM)

Rio de Janeiro, Rio de Janeiro (Brasilia ST): as expected (change on 2/17 at 12:00 AM (goes back one hour to 2/16 11:00 PM)

Federal District Brasilia, Brasilia (Brasilia ST): as expected (change on 2/17 at 12:00 AM (goes back one hour to 2/16 11:00 PM)

Santa Catarina, Florianopolis (Brasilia ST): as expected (change on 2/17 at 12:00 AM (goes back one hour to 2/16 11:00 PM)

Paraná: Not tested yet

Goiás: Not tested yet

Rio Grande do Sul: Not tested yet

Mato Grosso do Sul: Not tested yet

Espírito Santo: Not tested yet

Minas Gerais: Not tested yet

Mato Grosso (some exceptions): Not tested yet

Fiji: Not tested yet

@marek-safar marek-safar added this to the 2018-08 (5.18.xx) milestone Mar 19, 2019
marek-safar added a commit that referenced this issue Apr 2, 2019
I'm not sure about the correctness of this workaround but it works on macOS for the repro from #9664 (comment)

Transition bounds used by time zone info represent some local date-time but actually they are of Unspecified date-time kind. 
When we try to get transition offset we compare some current date-time converted to UTC with appropriate transition bounds.
The fix is to use UTC for both current date-time and transition bounds during comparing.

Fixes #9664
jonpryor added a commit to xamarin/xamarin-android that referenced this issue Apr 3, 2019
@marek-safar

This comment has been minimized.

Copy link
Member

@marek-safar marek-safar commented Apr 26, 2019

Closing, please reopen if you can still reproduce the issue in dev16.1 release

@jgold6

This comment has been minimized.

Copy link

@jgold6 jgold6 commented Apr 26, 2019

For the 5 affected time zones noted in my comments above, in Mono 5.18.1.18, DST for those 5 areas are no longer starting DST early. But now they are all starting DST 1 hour late. I.e if the time is supposed to jump from 2:00 AM to 3:00 AM, instead it is jumping from 3:00 AM to 4:00 AM.

breakdown:

Central Standard time (US), Eastern ST (Turks and Caicos), and Alaska Standard Time:
Should jump from 2:00 AM to 3:00 AM but DateTime.Now jumps from 3:00 AM to 4:00 AM

Cuba Standard Time and Azores Standard Time:
Should jump from 12:00 AM to 1:00 AM but DateTime.Now jumps from 1:00 AM to 2:00 AM

I only tested in a non-affected area for EST New York. This worked correctly. I did not test for any other locations where the issue was not occurring as per my notes in my previous comments

@jbatt33

This comment has been minimized.

Copy link
Author

@jbatt33 jbatt33 commented Apr 26, 2019

Thanks.

@jbatt33 I can reproduce it on 5.4.0.201 but can't do it on 6.1.x (master) I guess it was fixed by #11500 or #11232

Thanks for the information. Will pick up either by merging this fix into a 5.x release or wait for 6.0 official release

@jgold6

This comment has been minimized.

Copy link

@jgold6 jgold6 commented Apr 26, 2019

Checked on mono master. behavior is correct on mono master.

It would be great if we can get the full fix backported to the current VS for Mac Preview channel (currently has Mono 5.18.1.3, which has original issue I described), and also the internal preview channel (has Mono 5.18.1.18 currently which only changes when the error occurs... I assume this will become the next public preview channel)

@jgold6

This comment has been minimized.

Copy link

@jgold6 jgold6 commented Apr 29, 2019

@marek-safar

Testing Xam.Android and Xam.iOS in current public and internal VS for Mac Preview channels, behavior is the same as in mono 5.18.1.18, i.e. in the 5 affected areas, change to DST is one hour late.

breakdown:

Central Standard time (US), Eastern ST (Turks and Caicos), and Alaska Standard Time:
Should jump from 2:00 AM to 3:00 AM but DateTime.Now jumps from 3:00 AM to 4:00 AM

Cuba Standard Time and Azores Standard Time:
Should jump from 12:00 AM to 1:00 AM but DateTime.Now jumps from 1:00 AM to 2:00 AM

Versions:
public Preview:

  • XA: 9.3.0.14
  • XI: 12.10.0.147
  • Mono: 5.18.1.3

internal Preview:

  • XA: 9.3.0
  • XI: 12.10.0.148
  • Mono: 5.18.1.18
@MaximLipnin

This comment has been minimized.

Copy link
Collaborator

@MaximLipnin MaximLipnin commented May 2, 2019

According to the latest details the issue wasn't fully resolved. So I'm re-opening it.

@jgold6

This comment has been minimized.

Copy link

@jgold6 jgold6 commented Jun 6, 2019

Just tested the initially reported issue on the current Xamarin.Android (9.2.3.0) and Mono (5.18.1.3). European/Vatican time is still leaving European Summertime 2 hours later than expected.

The 5 affected areas that were starting DST late, i.e. Central Standard time (US), Eastern ST (Turks and Caicos), Alaska Standard Time, Cuba Standard Time, and Azores Standard Time, are leaving DST at the correct time.

@jgold6

This comment has been minimized.

Copy link

@jgold6 jgold6 commented Jun 6, 2019

Other areas tested for leaving DST:

Greenwich Mean Time (Guernsey): Leaves DST one hour later than expected, i.e. at 3:00 am rather than at 2:00 AM on 10/27

Tehran, Iran: Leaves DST 4 hours later than expected, i.e. at 4:00 am on 9/22 rather than at 12:00 AM on 9/22

I am sure there are more, but don't have time for full test right now.

However the above time zones all work as expected in Mono Master.

@marek-safar

This comment has been minimized.

Copy link
Member

@marek-safar marek-safar commented Jun 7, 2019

@jgold6 this didn't make it on time for 2018-02 insertion to Xamarin.Android. We have the fix available in dev16.2 P2 version which should be available publicly soon.

@jgold6

This comment has been minimized.

Copy link

@jgold6 jgold6 commented Jun 7, 2019

@marek-safar Can I assume that the same is true for insertion into Xam.iOS?

@marek-safar

This comment has been minimized.

Copy link
Member

@marek-safar marek-safar commented Jun 11, 2019

@jgold6 yes

@jgold6

This comment has been minimized.

Copy link

@jgold6 jgold6 commented Jun 22, 2019

@marek-safar

testing 16.2 P2 on Android:

Iran is leaving DST 1 hours late as compared to Android system time. This is improved over the 4 hours late previously tested above, but still not correct.

European/Vatican time is now leaving DST one hour late as opposed to 2 hours late, so again not fully fixed.

Greenwich Mean Time (Guernsey) is also now leaving DST 1 hour later than expected as compared to Android system time.

@steveisok

This comment has been minimized.

Copy link
Contributor

@steveisok steveisok commented Jun 22, 2019

@MaximLipnin Please have a look and see if you can determine why we're off.

@steveisok steveisok reopened this Jun 22, 2019
@MaximLipnin

This comment has been minimized.

Copy link
Collaborator

@MaximLipnin MaximLipnin commented Jun 24, 2019

@steveisok There was another attempt to fix this issue #14335 but it was not considered. I'll take a look.

jonpryor added a commit to xamarin/xamarin-android that referenced this issue Jun 28, 2019
jonpryor added a commit to xamarin/xamarin-android that referenced this issue Jun 28, 2019
akoeplinger added a commit that referenced this issue Jun 28, 2019
When a datetime appears in range of [end_of_DST_period - Daylight_delta; end_of_DST_period] it's not DST and should return base offset.

Fixes #9664.
@jgold6

This comment has been minimized.

Copy link

@jgold6 jgold6 commented Jul 3, 2019

Tested DateTime.Now issue in VS 2019 16.2 P4 ...

Issue still seems to be present in Xam.Android (9.4.0.50):
I tested these locales:
Tehran (Iran Time) leaves DST one hour late.
9/21/2019 10:59 PM should still be DST. 9/21/2019 11:00 PM should be standard time. DateTime.Now will be off by an hour between 9/21 11:00 PM until 11:59 AM. Note that if you set the date/time to 9/21/2019 10:59 PM and let it run, the time will be correct when 11:00 PM hits as this is the first go around. If you let it run for an hour, you will see the system time jump back to 11:00 PM while DateTime.Now does not. However if you set the date/time to directly to 9/21/2019 11:00 PM, then the Android OS chooses standard time and you should see DateTime.Now returning 12:00 AM while the system time shows 11:00 PM. What gets confusing here is that 11:00 - 11:59 PM happens twice... once under DST and once under standard time.

Vatican (Central European Time) leaves DST one hour late
the changeover date/time is 10/27/2019 at 2:00 AM. If you set the time to 10/27/2019 2:00 AM, you should see the DateTime.Now return 3:00 AM.

London/Guernsey (GMT) leaves DST one hour late
the changeover date/time is 10/27/2019 at 1:00 AM. If you set the time to 10/27/2019 1:00 AM, you should see the DateTime.Now return 2:00 AM.

Kiev (Eastern Europe Time) leaves DST one hour late
the changeover date/time is 10/27/2019 at 3:00 AM. If you set the time to 10/27/2019 3:00 AM, you should see the DateTime.Now return 4:00 AM.

Issue seems to be resolved on iOS (12.14.0.110)
I tested these locales:
Tehran (Iran Time)
Vatican (Central Europe Time)
London UK (Greenwich Mean Time)
Kiev, Ukraine (Eastern Europe Time)
And all left DST as expected. Tested on both simulator and device.

@jgold6

This comment has been minimized.

Copy link

@jgold6 jgold6 commented Jul 8, 2019

I just tested this again on Android and the behavior is correct for those 4 locales when leaving DST. This is using VS 2019 Preview 4 internal build.
Apparently my Shared mono runtime was not getting updated. Once I removed the shared mono runtime to force an update, DateTime.Now was returning the correct time on the above noted locales after leaving DST.
Not sure if relevant, but I also uninstalled the Xamarin Android API-XX support packages from the Andorid device.

akoeplinger added a commit that referenced this issue Jul 23, 2019
As an addition to #15401 it should resolve XA-related issue.

Fixes #9664

Backport of #15548.
jonpryor added a commit to xamarin/xamarin-android that referenced this issue Jul 26, 2019
jonpryor added a commit to xamarin/xamarin-android that referenced this issue Jul 26, 2019
jonpryor added a commit to xamarin/xamarin-android that referenced this issue Jul 26, 2019
jonpryor added a commit to xamarin/xamarin-android that referenced this issue Sep 6, 2019
Changes: http://github.com/mono/mono/compare/2c3aeaf3780de7392a0d3cbe4dcf86846eb4dffa...29b1ac19c961b959a09097dbc0fe4cd567cc5298

	$ git diff --shortstat 2c3aeaf3..29b1ac19
	 1528 files changed, 45421 insertions(+), 21967 deletions(-)

Changes: mono/api-doc-tools@d03e819...5da8127

	$ git diff --shortstat d03e8198..5da8127a
	 1001 files changed, 86168 insertions(+), 11863 deletions(-)

Changes: mono/api-snapshot@e09042d...1ca8e82

	$ git diff --shortstat e09042da..1ca8e82f
        28 files changed, 612 insertions(+), 217 deletions(-)

Changes: mono/cecil@a6c8f5e...cb6c1ca

	$ git diff --shortstat a6c8f5e1..cb6c1ca9
	 13 files changed, 233 insertions(+), 88 deletions(-)

Changes: mono/corefx@4806207...470e0e1

	$ git diff --shortstat 4806207f...470e0e10
	 4 files changed, 31 insertions(+), 12 deletions(-)

Changes: mono/linker@ebe2a1f...1f87de3

	$ git diff --shortstat ebe2a1f4...1f87de35
        90 files changed, 3219 insertions(+), 1224 deletions(-)

Changes: xamarin/java.interop@befdbc0...be6048e

	$ git diff --shortstat befdbc03...be6048ed
        3 files changed, 3 insertions(+), 3 deletions(-)

Upstream-Fixes: https://bugs.winehq.org/show_bug.cgi?id=47561
Upstream-Fixes: https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_workitems/edit/967582
Upstream-Fixes: dotnet/coreclr#25071
Upstream-Fixes: dotnet/coreclr#25242
Upstream-Fixes: dotnet/coreclr#25632
Upstream-Fixes: dotnet/coreclr#25709
Upstream-Fixes: dotnet/corefx#37955
Upstream-Fixes: dotnet/corefx#38455
Upstream-Fixes: mono/mono#7377
Upstream-Fixes: mono/mono#8747
Upstream-Fixes: mono/mono#9621
Upstream-Fixes: mono/mono#9664
Upstream-Fixes: mono/mono#9706
Upstream-Fixes: mono/mono#10201
Upstream-Fixes: mono/mono#10645
Upstream-Fixes: mono/mono#10748
Upstream-Fixes: mono/mono#10848
Upstream-Fixes: mono/mono#12141
Upstream-Fixes: mono/mono#13311
Upstream-Fixes: mono/mono#13408
Upstream-Fixes: mono/mono#13412
Upstream-Fixes: mono/mono#13891
Upstream-Fixes: mono/mono#13923
Upstream-Fixes: mono/mono#13945
Upstream-Fixes: mono/mono#14170
Upstream-Fixes: mono/mono#14214
Upstream-Fixes: mono/mono#14214
Upstream-Fixes: mono/mono#14215
Upstream-Fixes: mono/mono#14243
Upstream-Fixes: mono/mono#14377
Upstream-Fixes: mono/mono#14495
Upstream-Fixes: mono/mono#14555
Upstream-Fixes: mono/mono#14724
Upstream-Fixes: mono/mono#14729
Upstream-Fixes: mono/mono#14772
Upstream-Fixes: mono/mono#14792
Upstream-Fixes: mono/mono#14793
Upstream-Fixes: mono/mono#14809
Upstream-Fixes: mono/mono#14830
Upstream-Fixes: mono/mono#14839
Upstream-Fixes: mono/mono#14841
Upstream-Fixes: mono/mono#14847
Upstream-Fixes: mono/mono#14864
Upstream-Fixes: mono/mono#14871
Upstream-Fixes: mono/mono#14917
Upstream-Fixes: mono/mono#14945
Upstream-Fixes: mono/mono#14946
Upstream-Fixes: mono/mono#14948
Upstream-Fixes: mono/mono#14957
Upstream-Fixes: mono/mono#14959
Upstream-Fixes: mono/mono#14960
Upstream-Fixes: mono/mono#14961
Upstream-Fixes: mono/mono#14963
Upstream-Fixes: mono/mono#14971
Upstream-Fixes: mono/mono#14972
Upstream-Fixes: mono/mono#14975
Upstream-Fixes: mono/mono#15023
Upstream-Fixes: mono/mono#15048
Upstream-Fixes: mono/mono#15058
Upstream-Fixes: mono/mono#15080
Upstream-Fixes: mono/mono#15182
Upstream-Fixes: mono/mono#15188
Upstream-Fixes: mono/mono#15189
Upstream-Fixes: mono/mono#15261
Upstream-Fixes: mono/mono#15262
Upstream-Fixes: mono/mono#15263
Upstream-Fixes: mono/mono#15265
Upstream-Fixes: mono/mono#15268
Upstream-Fixes: mono/mono#15307
Upstream-Fixes: mono/mono#15324
Upstream-Fixes: mono/mono#15329
Upstream-Fixes: mono/mono#15330
Upstream-Fixes: mono/mono#15441
Upstream-Fixes: mono/mono#15446
Upstream-Fixes: mono/mono#15503
Upstream-Fixes: mono/mono#15541
Upstream-Fixes: mono/mono#15551
Upstream-Fixes: mono/mono#15556
Upstream-Fixes: mono/mono#15596
Upstream-Fixes: mono/mono#15691
Upstream-Fixes: mono/mono#15692
Upstream-Fixes: mono/mono#15740
Upstream-Fixes: mono/mono#15751
Upstream-Fixes: mono/mono#15760
Upstream-Fixes: mono/mono#15781
Upstream-Fixes: mono/mono#15794
Upstream-Fixes: mono/mono#15825
Upstream-Fixes: mono/mono#15853
Upstream-Fixes: mono/mono#15878
Upstream-Fixes: mono/mono#15887
Upstream-Fixes: mono/mono#15990
Upstream-Fixes: mono/mono#16032
Upstream-Fixes: mono/mono#16411
Upstream-Fixes: mono/mono#16486
Upstream-Fixes: https://github.com/mono/mono/issues/25709
Upstream-Fixes: https://github.com/mono/mono/issues/38821
Upstream-Fixes: #3112
Upstream-Fixes: #3168

Update `build-tools/automation/build.groovy` so that it fully cleans
the build tree before starting the build, so that the vestigial mono
submodule (removed in 0c9f83b) is *actually* removed from the build
tree, so that we don't inadvertently use *ancient* submodule contents.
jonpryor added a commit to jonpryor/xamarin-android that referenced this issue Sep 6, 2019
Changes: http://github.com/mono/mono/compare/2c3aeaf3780de7392a0d3cbe4dcf86846eb4dffa...29b1ac19c961b959a09097dbc0fe4cd567cc5298

	$ git diff --shortstat 2c3aeaf3..29b1ac19
	 1528 files changed, 45421 insertions(+), 21967 deletions(-)

Changes: mono/api-doc-tools@d03e819...5da8127

	$ git diff --shortstat d03e8198..5da8127a
	 1001 files changed, 86168 insertions(+), 11863 deletions(-)

Changes: mono/api-snapshot@e09042d...1ca8e82

	$ git diff --shortstat e09042da..1ca8e82f
        28 files changed, 612 insertions(+), 217 deletions(-)

Changes: mono/cecil@a6c8f5e...cb6c1ca

	$ git diff --shortstat a6c8f5e1..cb6c1ca9
	 13 files changed, 233 insertions(+), 88 deletions(-)

Changes: mono/corefx@4806207...470e0e1

	$ git diff --shortstat 4806207f...470e0e10
	 4 files changed, 31 insertions(+), 12 deletions(-)

Changes: mono/linker@ebe2a1f...1f87de3

	$ git diff --shortstat ebe2a1f4...1f87de35
	 90 files changed, 3219 insertions(+), 1224 deletions(-)

Changes: xamarin/java.interop@75b1189...4fd3539

	$ git diff --shortstat 75b11891...4fd35393
	 34 files changed, 448 insertions(+), 52 deletions(-)

Upstream-Fixes: https://bugs.winehq.org/show_bug.cgi?id=47561
Upstream-Fixes: https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_workitems/edit/967582
Upstream-Fixes: dotnet/coreclr#25071
Upstream-Fixes: dotnet/coreclr#25242
Upstream-Fixes: dotnet/coreclr#25632
Upstream-Fixes: dotnet/coreclr#25709
Upstream-Fixes: dotnet/corefx#37955
Upstream-Fixes: dotnet/corefx#38455
Upstream-Fixes: mono/mono#7377
Upstream-Fixes: mono/mono#8747
Upstream-Fixes: mono/mono#9621
Upstream-Fixes: mono/mono#9664
Upstream-Fixes: mono/mono#9706
Upstream-Fixes: mono/mono#10201
Upstream-Fixes: mono/mono#10645
Upstream-Fixes: mono/mono#10748
Upstream-Fixes: mono/mono#10848
Upstream-Fixes: mono/mono#12141
Upstream-Fixes: mono/mono#13311
Upstream-Fixes: mono/mono#13408
Upstream-Fixes: mono/mono#13412
Upstream-Fixes: mono/mono#13891
Upstream-Fixes: mono/mono#13923
Upstream-Fixes: mono/mono#13945
Upstream-Fixes: mono/mono#14170
Upstream-Fixes: mono/mono#14214
Upstream-Fixes: mono/mono#14214
Upstream-Fixes: mono/mono#14215
Upstream-Fixes: mono/mono#14243
Upstream-Fixes: mono/mono#14377
Upstream-Fixes: mono/mono#14495
Upstream-Fixes: mono/mono#14555
Upstream-Fixes: mono/mono#14724
Upstream-Fixes: mono/mono#14729
Upstream-Fixes: mono/mono#14772
Upstream-Fixes: mono/mono#14792
Upstream-Fixes: mono/mono#14793
Upstream-Fixes: mono/mono#14809
Upstream-Fixes: mono/mono#14830
Upstream-Fixes: mono/mono#14839
Upstream-Fixes: mono/mono#14841
Upstream-Fixes: mono/mono#14847
Upstream-Fixes: mono/mono#14864
Upstream-Fixes: mono/mono#14871
Upstream-Fixes: mono/mono#14917
Upstream-Fixes: mono/mono#14945
Upstream-Fixes: mono/mono#14946
Upstream-Fixes: mono/mono#14948
Upstream-Fixes: mono/mono#14957
Upstream-Fixes: mono/mono#14959
Upstream-Fixes: mono/mono#14960
Upstream-Fixes: mono/mono#14961
Upstream-Fixes: mono/mono#14963
Upstream-Fixes: mono/mono#14971
Upstream-Fixes: mono/mono#14972
Upstream-Fixes: mono/mono#14975
Upstream-Fixes: mono/mono#15023
Upstream-Fixes: mono/mono#15048
Upstream-Fixes: mono/mono#15058
Upstream-Fixes: mono/mono#15080
Upstream-Fixes: mono/mono#15182
Upstream-Fixes: mono/mono#15188
Upstream-Fixes: mono/mono#15189
Upstream-Fixes: mono/mono#15261
Upstream-Fixes: mono/mono#15262
Upstream-Fixes: mono/mono#15263
Upstream-Fixes: mono/mono#15265
Upstream-Fixes: mono/mono#15268
Upstream-Fixes: mono/mono#15307
Upstream-Fixes: mono/mono#15324
Upstream-Fixes: mono/mono#15329
Upstream-Fixes: mono/mono#15330
Upstream-Fixes: mono/mono#15441
Upstream-Fixes: mono/mono#15446
Upstream-Fixes: mono/mono#15503
Upstream-Fixes: mono/mono#15541
Upstream-Fixes: mono/mono#15551
Upstream-Fixes: mono/mono#15556
Upstream-Fixes: mono/mono#15596
Upstream-Fixes: mono/mono#15691
Upstream-Fixes: mono/mono#15692
Upstream-Fixes: mono/mono#15740
Upstream-Fixes: mono/mono#15751
Upstream-Fixes: mono/mono#15760
Upstream-Fixes: mono/mono#15781
Upstream-Fixes: mono/mono#15794
Upstream-Fixes: mono/mono#15825
Upstream-Fixes: mono/mono#15853
Upstream-Fixes: mono/mono#15878
Upstream-Fixes: mono/mono#15887
Upstream-Fixes: mono/mono#15990
Upstream-Fixes: mono/mono#16032
Upstream-Fixes: mono/mono#16411
Upstream-Fixes: mono/mono#16486
Upstream-Fixes: https://github.com/mono/mono/issues/25709
Upstream-Fixes: https://github.com/mono/mono/issues/38821
Upstream-Fixes: xamarin#3112
Upstream-Fixes: xamarin#3168

Update `build-tools/automation/build.groovy` so that it fully cleans
the build tree before starting the build, so that the vestigial mono
submodule (removed in 0c9f83b) is *actually* removed from the build
tree, so that we don't inadvertently use *ancient* submodule contents.
jonpryor added a commit to xamarin/xamarin-android that referenced this issue Sep 7, 2019
Changes: http://github.com/mono/mono/compare/2c3aeaf3780de7392a0d3cbe4dcf86846eb4dffa...29b1ac19c961b959a09097dbc0fe4cd567cc5298

	$ git diff --shortstat 2c3aeaf3..29b1ac19
	 1528 files changed, 45421 insertions(+), 21967 deletions(-)

Changes: mono/api-doc-tools@d03e819...5da8127

	$ git diff --shortstat d03e8198..5da8127a
	 1001 files changed, 86168 insertions(+), 11863 deletions(-)

Changes: mono/api-snapshot@e09042d...1ca8e82

	$ git diff --shortstat e09042da..1ca8e82f
        28 files changed, 612 insertions(+), 217 deletions(-)

Changes: mono/cecil@a6c8f5e...cb6c1ca

	$ git diff --shortstat a6c8f5e1..cb6c1ca9
	 13 files changed, 233 insertions(+), 88 deletions(-)

Changes: mono/corefx@4806207...470e0e1

	$ git diff --shortstat 4806207f...470e0e10
	 4 files changed, 31 insertions(+), 12 deletions(-)

Changes: mono/linker@ebe2a1f...1f87de3

	$ git diff --shortstat ebe2a1f4...1f87de35
	 90 files changed, 3219 insertions(+), 1224 deletions(-)

Changes: xamarin/java.interop@75b1189...4fd3539

	$ git diff --shortstat 75b11891...4fd35393
	 34 files changed, 448 insertions(+), 52 deletions(-)

Fixes: #3112
Fixes: #3168

Context: https://bugs.winehq.org/show_bug.cgi?id=47561
Context: https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_workitems/edit/967582
Context: dotnet/coreclr#25071
Context: dotnet/coreclr#25242
Context: dotnet/coreclr#25632
Context: dotnet/coreclr#25709
Context: dotnet/corefx#37955
Context: dotnet/corefx#38455
Context: mono/mono#7377
Context: mono/mono#8747
Context: mono/mono#9621
Context: mono/mono#9664
Context: mono/mono#9706
Context: mono/mono#10201
Context: mono/mono#10645
Context: mono/mono#10748
Context: mono/mono#10848
Context: mono/mono#12141
Context: mono/mono#13311
Context: mono/mono#13408
Context: mono/mono#13412
Context: mono/mono#13891
Context: mono/mono#13923
Context: mono/mono#13945
Context: mono/mono#14170
Context: mono/mono#14214
Context: mono/mono#14214
Context: mono/mono#14215
Context: mono/mono#14243
Context: mono/mono#14377
Context: mono/mono#14495
Context: mono/mono#14555
Context: mono/mono#14724
Context: mono/mono#14729
Context: mono/mono#14772
Context: mono/mono#14792
Context: mono/mono#14793
Context: mono/mono#14809
Context: mono/mono#14830
Context: mono/mono#14839
Context: mono/mono#14841
Context: mono/mono#14847
Context: mono/mono#14864
Context: mono/mono#14871
Context: mono/mono#14917
Context: mono/mono#14945
Context: mono/mono#14946
Context: mono/mono#14948
Context: mono/mono#14957
Context: mono/mono#14959
Context: mono/mono#14960
Context: mono/mono#14961
Context: mono/mono#14963
Context: mono/mono#14971
Context: mono/mono#14972
Context: mono/mono#14975
Context: mono/mono#15023
Context: mono/mono#15048
Context: mono/mono#15058
Context: mono/mono#15080
Context: mono/mono#15182
Context: mono/mono#15188
Context: mono/mono#15189
Context: mono/mono#15261
Context: mono/mono#15262
Context: mono/mono#15263
Context: mono/mono#15265
Context: mono/mono#15268
Context: mono/mono#15307
Context: mono/mono#15324
Context: mono/mono#15329
Context: mono/mono#15330
Context: mono/mono#15441
Context: mono/mono#15446
Context: mono/mono#15503
Context: mono/mono#15541
Context: mono/mono#15551
Context: mono/mono#15556
Context: mono/mono#15596
Context: mono/mono#15691
Context: mono/mono#15692
Context: mono/mono#15740
Context: mono/mono#15751
Context: mono/mono#15760
Context: mono/mono#15781
Context: mono/mono#15794
Context: mono/mono#15825
Context: mono/mono#15853
Context: mono/mono#15878
Context: mono/mono#15887
Context: mono/mono#15990
Context: mono/mono#16032
Context: mono/mono#16411
Context: mono/mono#16486
Context: https://github.com/mono/mono/issues/25709
Context: https://github.com/mono/mono/issues/38821

Update `build-tools/automation/build.groovy` so that it fully cleans
the build tree before starting the build, so that the vestigial mono
submodule (removed in 0c9f83b) is *actually* removed from the build
tree, so that we don't inadvertently use *ancient* submodule contents.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants
You can’t perform that action at this time.