HDDS-403. Fix createdOn and modifiedOn timestamp for volume, bucket, key. Contributed by Dinesh Chitlangia.
(cherry picked from commit 8fe4062bfc
)
This commit is contained in:
parent
dfd7ece2df
commit
4b9f1d7639
|
@ -74,7 +74,7 @@ public final class HddsClientUtils {
|
|||
*/
|
||||
public static String formatDateTime(long millis) {
|
||||
ZonedDateTime dateTime = ZonedDateTime.ofInstant(
|
||||
Instant.ofEpochSecond(millis), DATE_FORMAT.get().getZone());
|
||||
Instant.ofEpochMilli(millis), DATE_FORMAT.get().getZone());
|
||||
return DATE_FORMAT.get().format(dateTime);
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ public final class HddsClientUtils {
|
|||
public static long formatDateTime(String date) throws ParseException {
|
||||
Preconditions.checkNotNull(date, "Date string should not be null.");
|
||||
return ZonedDateTime.parse(date, DATE_FORMAT.get())
|
||||
.toInstant().getEpochSecond();
|
||||
.toInstant().toEpochMilli();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -250,8 +250,8 @@ public class KeyManagerImpl implements KeyManager {
|
|||
.setKeyName(args.getKeyName())
|
||||
.setOmKeyLocationInfos(Collections.singletonList(
|
||||
new OmKeyLocationInfoGroup(0, locations)))
|
||||
.setCreationTime(currentTime)
|
||||
.setModificationTime(currentTime)
|
||||
.setCreationTime(Time.now())
|
||||
.setModificationTime(Time.now())
|
||||
.setDataSize(size)
|
||||
.setReplicationType(type)
|
||||
.setReplicationFactor(factor)
|
||||
|
|
Loading…
Reference in New Issue