Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 22369655 authored by Amit Mahajan's avatar Amit Mahajan Committed by Gerrit Code Review
Browse files

Merge "Use month in the range 1-12 for 3GPP2 SMS Time Stamp instead"

parents fbbb808b c8ec7316
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -248,10 +248,10 @@ public final class BearerData {
        public int hour;
        public int monthDay;

        /** Month [0-11] */
        public int month;
        /** Month in the range 1(Jan) - 12(Dec). */
        public int monthOrdinal;

        /** Full year. For example, 1970. */
        /** Full year in the range 1996 - 2095. */
        public int year;

        private ZoneId mZoneId;
@@ -269,7 +269,7 @@ public final class BearerData {
            ts.year = year >= 96 ? year + 1900 : year + 2000;
            int month = IccUtils.cdmaBcdByteToInt(data[1]);
            if (month < 1 || month > 12) return null;
            ts.month = month - 1;
            ts.monthOrdinal = month;
            int day = IccUtils.cdmaBcdByteToInt(data[2]);
            if (day < 1 || day > 31) return null;
            ts.monthDay = day;
@@ -292,7 +292,7 @@ public final class BearerData {
            int year = localDateTime.getYear();
            if (year < 1996 || year > 2095) return null;
            ts.year = year;
            ts.month = localDateTime.getMonthValue();
            ts.monthOrdinal = localDateTime.getMonthValue();
            ts.monthDay = localDateTime.getDayOfMonth();
            ts.hour = localDateTime.getHour();
            ts.minute = localDateTime.getMinute();
@@ -304,7 +304,7 @@ public final class BearerData {
            int year = this.year % 100; // 00 - 99
            ByteArrayOutputStream outStream = new ByteArrayOutputStream(6);
            outStream.write((((year / 10) & 0x0F) << 4) | ((year % 10) & 0x0F));
            outStream.write((((month / 10) << 4) & 0xF0) | ((month % 10) & 0x0F));
            outStream.write((((monthOrdinal / 10) << 4) & 0xF0) | ((monthOrdinal % 10) & 0x0F));
            outStream.write((((monthDay / 10) << 4) & 0xF0) | ((monthDay % 10) & 0x0F));
            outStream.write((((hour / 10) << 4) & 0xF0) | ((hour % 10) & 0x0F));
            outStream.write((((minute / 10) << 4) & 0xF0) | ((minute % 10) & 0x0F));
@@ -314,7 +314,7 @@ public final class BearerData {

        public long toMillis() {
            LocalDateTime localDateTime =
                    LocalDateTime.of(year, month + 1, monthDay, hour, minute, second);
                    LocalDateTime.of(year, monthOrdinal, monthDay, hour, minute, second);
            Instant instant = localDateTime.toInstant(mZoneId.getRules().getOffset(localDateTime));
            return instant.toEpochMilli();
        }
@@ -325,7 +325,7 @@ public final class BearerData {
            StringBuilder builder = new StringBuilder();
            builder.append("TimeStamp ");
            builder.append("{ year=" + year);
            builder.append(", month=" + month);
            builder.append(", month=" + monthOrdinal);
            builder.append(", day=" + monthDay);
            builder.append(", hour=" + hour);
            builder.append(", minute=" + minute);