Skip to content

Commit

Permalink
Handling null clock case
Browse files Browse the repository at this point in the history
  • Loading branch information
umbernhard committed Dec 5, 2024
1 parent 7635185 commit 0ebf4b7
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,11 @@ public Instant lastLoginTime() {
* Updates the last login time to the current time.
*/
public void updateLastLoginTime() {
my_last_login_time = Instant.now(my_clock);
if (my_clock == null) {
my_last_login_time = Instant.now();
} else {
my_last_login_time = Instant.now(my_clock);
}
}

/**
Expand All @@ -222,7 +226,11 @@ public Instant lastLogoutTime() {
* Updates the last logout time to the current time.
*/
public void updateLastLogoutTime() {
my_last_logout_time = Instant.now(my_clock);
if (my_clock == null) {
my_last_login_time = Instant.now();
} else {
my_last_login_time = Instant.now(my_clock);
}
}

/**
Expand Down

0 comments on commit 0ebf4b7

Please sign in to comment.