Skip to content

Signed reference expiration time is measured in seconds since epoch #107

Closed
@jboynes

Description

@jboynes

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

Metadata

Metadata

Assignees

Labels

🚨This issue needs some love.api: storageIssues related to the Cloud Storage API.triage meI really want to be triaged.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions