diff options
| author | 2020-02-18 20:49:14 +0000 | |
|---|---|---|
| committer | 2020-02-18 20:49:14 +0000 | |
| commit | fe80efe1d1a42fe39f152ef44b3a0f6773fbca6d (patch) | |
| tree | 09e2e06ebd753ad318fbfbf04ac78a27d79d7914 | |
| parent | f6ac8fca825180a5e4a661ae8c478388d51eb3f0 (diff) | |
| parent | 223696559f7c3b5161403a9e11a6bbfde76ac9dc (diff) | |
Merge "Use month in the range 1-12 for 3GPP2 SMS Time Stamp instead" am: 223696559f
Change-Id: I16bf32e2bcdfd6ac04c19c0112f8c2ce56bd0271
| -rw-r--r-- | telephony/java/com/android/internal/telephony/cdma/sms/BearerData.java | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/telephony/java/com/android/internal/telephony/cdma/sms/BearerData.java b/telephony/java/com/android/internal/telephony/cdma/sms/BearerData.java index 39f1fc2d0a8d..48cb1cd84c07 100644 --- a/telephony/java/com/android/internal/telephony/cdma/sms/BearerData.java +++ b/telephony/java/com/android/internal/telephony/cdma/sms/BearerData.java @@ -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); |