Closed
Description
Java measures time in milliseconds from the epoch not seconds and using this as a base would be simpler. The example:
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DATE, 1);
long expiration = cal.getTimeInMillis() / 1000;
storage.signUrl(blobInfo, expiration));
would become:
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DATE, 1);
storage.signUrl(blobInfo, cal.getTime()));
However, given this is actually just performing an interval calculation we could also support:
storage.signUrl(blobInfo, 1, TimeUnit.DAYS);
Ideally we would also support the time classes added in Java 8:
storage.signUrl(blobInfo, Instant.now().plus(24, ChronoUnit.HOURS));
storage.signUrl(blobInfo, Duration.ofDays(1));