diff options
author | Guang Zhu <guangzhu@google.com> | 2022-05-16 22:42:17 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2022-05-16 22:42:17 +0000 |
commit | 7d1a227ff79e5cc0f88eed99ef516c5aec9cce5c (patch) | |
tree | 4b825dc642cb6eb9a060e54bf8d69288fbee4904 /src/main/java/com/android/vts/util/TimeUtil.java | |
parent | a9bd47e4caa21d535fb89c0e6efe23fa08d25847 (diff) | |
parent | 5b68078669f69925457f616994578babeabafc50 (diff) | |
download | dashboard-7d1a227ff79e5cc0f88eed99ef516c5aec9cce5c.tar.gz |
remove code for vti dashboard am: 4ebfbc3e96 am: 4642c7edfa am: 5b68078669android12L-tests-dev
Original change: https://android-review.googlesource.com/c/platform/test/vti/dashboard/+/1926182
Change-Id: Ie701e4405fef964a477b198389ccfdd622fade10
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'src/main/java/com/android/vts/util/TimeUtil.java')
-rw-r--r-- | src/main/java/com/android/vts/util/TimeUtil.java | 80 |
1 files changed, 0 insertions, 80 deletions
diff --git a/src/main/java/com/android/vts/util/TimeUtil.java b/src/main/java/com/android/vts/util/TimeUtil.java deleted file mode 100644 index 7e9be26..0000000 --- a/src/main/java/com/android/vts/util/TimeUtil.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ -package com.android.vts.util; - -import java.time.Instant; -import java.time.ZoneId; -import java.time.ZonedDateTime; -import java.time.format.DateTimeFormatter; -import java.util.concurrent.TimeUnit; -import java.util.logging.Logger; - -/** TimeUtil, a helper class for formatting times. */ -public class TimeUtil { - protected static final Logger logger = Logger.getLogger(TimeUtil.class.getName()); - - public static final String DATE_FORMAT = "yyyy-MM-dd"; - public static final String DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss"; - public static final String DATE_TIME_ZONE_FORMAT = "yyyy-MM-dd HH:mm:ss (z)"; - public static final ZoneId PT_ZONE = ZoneId.of("America/Los_Angeles"); - - /** - * Create a date time string with zone info from the provided timestamp. - * - * @param timeMicroseconds The time in microseconds - * @return A formatted date time string. - */ - public static String getDateTimeZoneString(long timeMicroseconds) { - long timeMillis = TimeUnit.MICROSECONDS.toMillis(timeMicroseconds); - ZonedDateTime zdt = ZonedDateTime.ofInstant(Instant.ofEpochMilli(timeMillis), PT_ZONE); - return DateTimeFormatter.ofPattern(DATE_TIME_ZONE_FORMAT).format(zdt); - } - - /** - * Create a date string from the provided timestamp. - * - * @param timeMicroseconds The time in microseconds - * @return A formatted date string. - */ - public static String getDateString(long timeMicroseconds) { - long timeMillis = TimeUnit.MICROSECONDS.toMillis(timeMicroseconds); - ZonedDateTime zdt = ZonedDateTime.ofInstant(Instant.ofEpochMilli(timeMillis), PT_ZONE); - return DateTimeFormatter.ofPattern(DATE_FORMAT).format(zdt); - } - - /** - * Create a date string from the provided timestamp. - * - * @param timeMicroseconds The time in microseconds - * @return A formatted date string. - */ - public static String getDateTimeString(long timeMicroseconds) { - long timeMillis = TimeUnit.MICROSECONDS.toMillis(timeMicroseconds); - ZonedDateTime zdt = ZonedDateTime.ofInstant(Instant.ofEpochMilli(timeMillis), PT_ZONE); - return DateTimeFormatter.ofPattern(DATE_TIME_FORMAT).format(zdt); - } - - /** - * Create a ZonedDateTime object from the provided timestamp. - * - * @param timeMicroseconds The time in microseconds - * @return A ZonedDateTime object. - */ - public static ZonedDateTime getZonedDateTime(long timeMicroseconds) { - long timeMillis = TimeUnit.MICROSECONDS.toMillis(timeMicroseconds); - return ZonedDateTime.ofInstant(Instant.ofEpochMilli(timeMillis), PT_ZONE); - } -} |