Skip to content

Commit

Permalink
fix: using 2001 as min year to prevent time overflow when converting …
Browse files Browse the repository at this point in the history
…to UTC from local time
  • Loading branch information
sembruk committed Jan 28, 2025
1 parent ab4a924 commit 56b8f87
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ android {
applicationId "org.sportiduino.app"
minSdk 21
targetSdk 31
versionCode 10
versionName "1.5.0"
versionCode 11
versionName "1.5.1"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ public class Constants {
public static final byte MASTER_CARD_SIGN = (byte) 0xFF;
public static final byte FAST_PUNCH_SIGN = (byte) 0xAA;
public static final byte FW_PROTO_VERSION = (byte) 8;
public static final int OPERATED_YEAR_MIN = 2000;
public static final int OPERATED_YEAR_MIN = 2001;
}
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public static byte[][] packStationNumber(int stationNumber) {
public static byte[][] packTime(Calendar calendar) {
Calendar c = (Calendar) calendar.clone();
c.setTimeZone(TimeZone.getTimeZone("UTC"));
int year = c.get(Calendar.YEAR) - OPERATED_YEAR_MIN;
int year = c.get(Calendar.YEAR) - 2000;
int month = c.get(Calendar.MONTH) + 1;
int day = c.get(Calendar.DAY_OF_MONTH);
int hour = c.get(Calendar.HOUR_OF_DAY);
Expand Down

0 comments on commit 56b8f87

Please sign in to comment.