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