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:
Xiaoyu Yao 2018-09-10 08:45:49 -07:00
parent dfd7ece2df
commit 4b9f1d7639
2 changed files with 4 additions and 4 deletions

View File

@ -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();
}

View File

@ -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)