This repository was archived by the owner on Feb 6, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
google-cloud-logging/src/test/java/com/google/cloud/logging Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1616
1717package com .google .cloud .logging ;
1818
19- import static java .time .ZoneOffset .UTC ;
20-
2119import com .google .api .gax .paging .Page ;
2220import com .google .cloud .MonitoredResource ;
2321import com .google .cloud .logging .testing .RemoteLoggingHelper ;
2422import com .google .common .collect .Iterables ;
2523import com .google .logging .v2 .LogName ;
24+
25+ import java .time .Instant ;
2626import java .time .format .DateTimeFormatter ;
27- import java .util . Calendar ;
27+ import java .time . temporal . ChronoUnit ;
2828import java .util .Iterator ;
2929import java .util .concurrent .TimeUnit ;
3030import org .junit .jupiter .api .AfterAll ;
@@ -83,11 +83,8 @@ protected static boolean cleanupLog(String logName) throws InterruptedException
8383 * Filters Documentation</a>
8484 */
8585 protected static String createTimestampFilter (int hoursAgo ) {
86- Calendar calendar = Calendar .getInstance ();
87- calendar .add (Calendar .HOUR , -1 * hoursAgo );
88- return "timestamp>=\" "
89- + calendar .getTime ().toInstant ().atZone (UTC ).toLocalDateTime ().format (RFC_3339 )
90- + "\" " ;
86+ Instant now = Instant .now ().minus (hoursAgo , ChronoUnit .HOURS );
87+ return "timestamp>=\" " + RFC_3339 .format (now ) + "\" " ;
9188 }
9289
9390 protected static String appendResourceTypeFilter (
You can’t perform that action at this time.
0 commit comments