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 @@ private 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 static String formatDateTime(long millis) {
|
|||||||
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 OpenKeySession openKey(OmKeyArgs args) throws IOException {
|
|||||||
.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
Block a user