Skip to content

Commit

Permalink
std/time: add the Zone method to Time
Browse files Browse the repository at this point in the history
  • Loading branch information
mertcandav committed Nov 25, 2024
1 parent 7c84bba commit 1e5dd18
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions std/time/time.jule
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,13 @@ impl Time {
ret absSeconds(self.abs())
}

// Computes the time zone in effect at time specification, returning the abbreviated
// name of the zone (such as "CET") and its offset in seconds east of UTC.
fn Zone(self): (name: str, offset: int) {
name, offset, _, _, _ = self.loc.lookup(self.sec)
ret
}

// Returns the year of the time.
fn Year(self): int {
century, cyear, ayday := self.absSec().days().split()
Expand Down

0 comments on commit 1e5dd18

Please sign in to comment.