Uploaded image for project: 'Apache Avro'
  1. Apache Avro
  2. AVRO-4080

C# local-timestamp-* conversions are affected by local time zone

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.11.1, 1.12.0
    • None
    • csharp, logical types
    • None

    Description

      In the C# implementation of logical types "local-timestamp-millis" and "local-timestamp-micros", the conversion between DateTime and Int64 depends on the local time zone of the process: ConvertToBaseValue calls DateTime.ToUniversalTime(), and ConvertToLogicalValue calls DateTime.ToLocalTime().  These time zone conversions should not be done. Instead, ConvertToBaseValue should discard DateTime.Kind, and ConvertToLogicalValue should set DateTimeKind.Unspecified.

      According to the Avro 1.12.0 specification:

      The time-millis logical type represents a time of day, with no reference to a particular calendar, time zone or date, with a precision of one millisecond.

      As there is no reference to a time zone, the value must not be assumed to be in the local time zone of the process. The current C# implementation is not consistent with the Java implementation, either.

      Attachments

        1. LocalTimestampTest.cs
          2 kB
          Kalle Niemitalo

        Issue Links

          Activity

            People

              Unassigned Unassigned
              kniemitalo Kalle Niemitalo
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: