mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Fix incorrect to_gmt_offset result
This commit is contained in:
committed by
Christoffer Lerno
parent
8a0b0f5cf5
commit
fe9e434020
@@ -105,7 +105,8 @@ fn TzDateTime DateTime.to_gmt_offset(self, int gmt_offset)
|
||||
* @ensure self.time == return.time
|
||||
**/
|
||||
fn TzDateTime TzDateTime.to_gmt_offset(self, int gmt_offset) {
|
||||
Time time = self.time + (Time)(gmt_offset - self.gmt_offset) * (Time)time::SEC;
|
||||
if (self.gmt_offset == gmt_offset) return self;
|
||||
Time time = self.time + (Time)gmt_offset * (Time)time::SEC;
|
||||
DateTime dt = from_time(time);
|
||||
dt.time = self.time;
|
||||
return { dt, gmt_offset };
|
||||
|
||||
Reference in New Issue
Block a user