Skip to content

Commit

Permalink
Update RelativeDateFormat.java
Browse files Browse the repository at this point in the history
simplify logic and improve performance
  • Loading branch information
xuxiawei authored Nov 19, 2021
1 parent 5ad5b41 commit 3c5b509
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 3c5b509

Please sign in to comment.