Skip to content

Commit ba3a12e

Browse files
committed
Use fixed GMT time-zone for WebSession Clock
Issue: SPR-15675
1 parent 043c0ef commit ba3a12e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

spring-web/src/main/java/org/springframework/web/server/session/DefaultWebSessionManager.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import java.time.Clock;
1919
import java.time.Instant;
20+
import java.time.ZoneId;
2021
import java.util.List;
2122
import java.util.UUID;
2223

@@ -41,7 +42,7 @@ public class DefaultWebSessionManager implements WebSessionManager {
4142

4243
private WebSessionStore sessionStore = new InMemoryWebSessionStore();
4344

44-
private Clock clock = Clock.systemDefaultZone();
45+
private Clock clock = Clock.system(ZoneId.of("GMT"));
4546

4647

4748
/**
@@ -82,7 +83,7 @@ public WebSessionStore getSessionStore() {
8283
* Configure the {@link Clock} for access to current time. During tests you
8384
* may use {code Clock.offset(clock, Duration.ofMinutes(-31))} to set the
8485
* clock back for example to test changes after sessions expire.
85-
* <p>By default {@link Clock#systemDefaultZone()} is used.
86+
* <p>By default {@code Clock.system(ZoneId.of("GMT"))} is used.
8687
* @param clock the clock to use
8788
*/
8889
public void setClock(Clock clock) {

0 commit comments

Comments
 (0)