Skip to content

Commit

Permalink
Update RelativeDateFormat.java (#4111)
Browse files Browse the repository at this point in the history
simplify logic and improve performance

Co-authored-by: Jason Song <[email protected]>
  • Loading branch information
xuxiawei and nobodyiam authored Nov 20, 2021
1 parent 046a13d commit 334f258
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static String format(Date date) {
return "now";
}

long delta = new Date().getTime() - date.getTime();
long delta = System.currentTimeMillis() - date.getTime();
if (delta < ONE_MINUTE) {
long seconds = toSeconds(delta);
return (seconds <= 0 ? 1 : seconds) + ONE_SECOND_AGO;
Expand Down

0 comments on commit 334f258

Please sign in to comment.