public override void WriteDateTime(long epochSecondUTC, int nano, string zoneId)
 {
     this.EpochSecondUTC    = epochSecondUTC;
     this.NanoOfSecond      = nano;
     this.ZoneId            = TimeZones.map(zoneId);
     this.ZoneOffsetSeconds = 0;
 }
Beispiel #2
0
 public override Value AsValue()
 {
     // We need to check validity upfront without throwing exceptions, because the PageCursor might give garbage bytes
     if (TimeZones.validZoneOffset(ZoneOffsetSeconds))
     {
         return(TimeValue.time(NanosOfDayUTC, ZoneOffset.ofTotalSeconds(ZoneOffsetSeconds)));
     }
     return(NO_VALUE);
 }
Beispiel #3
0
 internal static OffsetTime AsValueRaw(long long0, long long1)
 {
     if (TimeZones.validZoneOffset(( int )long1))
     {
         return(TimeValue.timeRaw(long0, ZoneOffset.ofTotalSeconds(( int )long1)));
     }
     // TODO Getting here means that after a proper read this value is plain wrong... shouldn't something be thrown instead? Yes and same for TimeZones
     return(null);
 }
Beispiel #4
0
        internal static int Compare(long thisLong0, long thisLong1, long thisLong2, long thisLong3, long thatLong0, long thatLong1, long thatLong2, long thatLong3)
        {
            int compare = Long.compare(thisLong0, thatLong0);

            if (compare == 0)
            {
                compare = Integer.compare(( int )thisLong1, ( int )thatLong1);
                if (compare == 0 && TimeZones.validZoneOffset(( int )thisLong3) && TimeZones.validZoneOffset(( int )thatLong3))
                {
                    // In the rare case of comparing the same instant in different time zones, we settle for
                    // mapping to values and comparing using the general values comparator.
                    compare = Values.COMPARATOR.Compare(AsValue(thisLong0, thisLong1, thisLong2, thisLong3), AsValue(thatLong0, thatLong1, thatLong2, thatLong3));
                }
            }
            return(compare);
        }
        public override int CompareValueTo(ZonedDateTimeIndexKey other)
        {
            int compare = Long.compare(EpochSecondUTC, other.EpochSecondUTC);

            if (compare == 0)
            {
                compare = Integer.compare(NanoOfSecond, other.NanoOfSecond);
                if (compare == 0 && TimeZones.validZoneOffset(ZoneOffsetSeconds) && TimeZones.validZoneOffset(other.ZoneOffsetSeconds))
                {
                    if (ZoneOffsetSeconds != other.ZoneOffsetSeconds || ZoneId != other.ZoneId)
                    {
                        // In the rare case of comparing the same instant in different time zones, we settle for
                        // mapping to values and comparing using the general values comparator.
                        compare = Values.COMPARATOR.Compare(AsValue(), other.AsValue());
                    }
                }
            }
            return(compare);
        }
 public override Value AsValue()
 {
     return(TimeZones.validZoneId(ZoneId) ? DateTimeValue.datetime(EpochSecondUTC, NanoOfSecond, ZoneId.of(TimeZones.map(ZoneId))) : DateTimeValue.datetime(EpochSecondUTC, NanoOfSecond, ZoneOffset.ofTotalSeconds(ZoneOffsetSeconds)));
 }
Beispiel #7
0
 internal static ZonedDateTime AsValueRaw(long long0, long long1, long long2, long long3)
 {
     return(TimeZones.validZoneId(( short )long2) ? DateTimeValue.datetimeRaw(long0, long1, ZoneId.of(TimeZones.map(( short )long2))) : DateTimeValue.datetimeRaw(long0, long1, ZoneOffset.ofTotalSeconds(( int )long3)));
 }