@@ -134,6 +134,9 @@ mg_date_time_zone_id *mg_date_time_zone_id_alloc(mg_allocator *allocator) {
134134 return NULL ;
135135 }
136136 mg_date_time_zone_id * date_time_zone_id = (mg_date_time_zone_id * )block ;
137+ date_time_zone_id -> seconds = 0 ;
138+ date_time_zone_id -> nanoseconds = 0 ;
139+ date_time_zone_id -> timezone_name = NULL ;
137140 return date_time_zone_id ;
138141}
139142
@@ -1279,9 +1282,9 @@ int64_t mg_date_time_zone_id_nanoseconds(
12791282 return date_time_zone_id -> nanoseconds ;
12801283}
12811284
1282- int64_t mg_date_time_zone_id_tz_id (
1285+ const mg_string * mg_date_time_zone_id_timezone_name (
12831286 const mg_date_time_zone_id * date_time_zone_id ) {
1284- return date_time_zone_id -> tz_id ;
1287+ return date_time_zone_id -> timezone_name ;
12851288}
12861289
12871290int64_t mg_local_date_time_seconds (const mg_local_date_time * local_date_time ) {
@@ -1442,7 +1445,14 @@ mg_date_time_zone_id *mg_date_time_zone_id_copy_ca(
14421445 if (!date_time_zone_id ) {
14431446 return NULL ;
14441447 }
1445- memcpy (date_time_zone_id , src , sizeof (mg_date_time_zone_id ));
1448+ date_time_zone_id -> seconds = src -> seconds ;
1449+ date_time_zone_id -> nanoseconds = src -> nanoseconds ;
1450+ date_time_zone_id -> timezone_name =
1451+ mg_string_copy_ca (src -> timezone_name , allocator );
1452+ if (!date_time_zone_id -> timezone_name ) {
1453+ mg_date_time_zone_id_destroy_ca (date_time_zone_id , allocator );
1454+ return NULL ;
1455+ }
14461456 return date_time_zone_id ;
14471457}
14481458
@@ -1456,6 +1466,7 @@ void mg_date_time_zone_id_destroy_ca(mg_date_time_zone_id *date_time_zone_id,
14561466 if (!date_time_zone_id ) {
14571467 return ;
14581468 }
1469+ mg_string_destroy_ca (date_time_zone_id -> timezone_name , allocator );
14591470 mg_allocator_free (allocator , date_time_zone_id );
14601471}
14611472
@@ -1657,6 +1668,39 @@ mg_local_time *mg_local_time_make(int64_t nanoseconds) {
16571668 return lt ;
16581669}
16591670
1671+ mg_date_time * mg_date_time_make (int64_t seconds , int64_t nanoseconds ,
1672+ int32_t tz_offset_minutes ) {
1673+ mg_date_time * dt = mg_date_time_alloc (& mg_system_allocator );
1674+ if (!dt ) {
1675+ return NULL ;
1676+ }
1677+ dt -> seconds = seconds ;
1678+ dt -> nanoseconds = nanoseconds ;
1679+ dt -> tz_offset_minutes = tz_offset_minutes ;
1680+ return dt ;
1681+ }
1682+
1683+ mg_date_time_zone_id * mg_date_time_zone_id_make (int64_t seconds ,
1684+ int64_t nanoseconds ,
1685+ const char * timezone_name ) {
1686+ mg_date_time_zone_id * dt_zone_id =
1687+ mg_date_time_zone_id_alloc (& mg_system_allocator );
1688+ if (!dt_zone_id ) {
1689+ return NULL ;
1690+ }
1691+
1692+ mg_string * tz_name = mg_string_make (timezone_name );
1693+ if (!tz_name ) {
1694+ mg_date_time_zone_id_destroy_ca (dt_zone_id , & mg_system_allocator );
1695+ return NULL ;
1696+ }
1697+
1698+ dt_zone_id -> seconds = seconds ;
1699+ dt_zone_id -> nanoseconds = nanoseconds ;
1700+ dt_zone_id -> timezone_name = tz_name ;
1701+ return dt_zone_id ;
1702+ }
1703+
16601704mg_local_date_time * mg_local_date_time_make (int64_t seconds ,
16611705 int64_t nanoseconds ) {
16621706 mg_local_date_time * ldt = mg_local_date_time_alloc (& mg_system_allocator );
@@ -1814,7 +1858,7 @@ int mg_local_date_time_equal(const mg_local_date_time *lhs,
18141858int mg_date_time_zone_id_equal (const mg_date_time_zone_id * lhs ,
18151859 const mg_date_time_zone_id * rhs ) {
18161860 return lhs -> seconds == rhs -> seconds && lhs -> nanoseconds == rhs -> nanoseconds &&
1817- lhs -> tz_id == rhs -> tz_id ;
1861+ mg_string_equal ( lhs -> timezone_name , rhs -> timezone_name ) ;
18181862}
18191863
18201864int mg_duration_equal (const mg_duration * lhs , const mg_duration * rhs ) {
0 commit comments