diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-08-17 20:35:09 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-08-17 20:35:09 -0400 |
| commit | f4e38fd061a158ecb94881273c6db6e6a332f61d (patch) | |
| tree | 9179cb312dcc1b24d806dfb65694c25580d1ed8b /lib/time | |
| parent | 602cedd03b0c3d6ef176efafb08f51bde9bfe543 (diff) | |
Switch from using dollar signs as namespace delimiters to using 々, ヽ, andunicode-identifiers
〇.
Diffstat (limited to 'lib/time')
| -rw-r--r-- | lib/time/time.tm | 24 | ||||
| -rw-r--r-- | lib/time/time_defs.h | 4 |
2 files changed, 14 insertions, 14 deletions
diff --git a/lib/time/time.tm b/lib/time/time.tm index 456b5f08..82d7d9eb 100644 --- a/lib/time/time.tm +++ b/lib/time/time.tm @@ -24,7 +24,7 @@ struct Time(tv_sec:Int64, tv_usec:Int64; extern) char *zoneinfo = strstr(buf, "/zoneinfo/"); if (zoneinfo) - _local_timezone = Text$from_str(zoneinfo + strlen("/zoneinfo/")); + _local_timezone = Textヽfrom_str(zoneinfo + strlen("/zoneinfo/")); else fail("Could not resolve local tz!"); } @@ -46,17 +46,17 @@ struct Time(tv_sec:Int64, tv_usec:Int64; extern) WITH_TIMEZONE(@timezone, final_info = localtime_r(&time, &result)); static char buf[256]; size_t len = strftime(buf, sizeof(buf), String(@format), final_info); - Text$from_strn(buf, len) + Textヽfrom_strn(buf, len) ) func new(year,month,day:Int, hour=0, minute=0, second=0.0, timezone=Time.local_timezone() -> Time) return C_code : Time( struct tm info = { - .tm_min=Int32$from_int(@minute, false), - .tm_hour=Int32$from_int(@hour, false), - .tm_mday=Int32$from_int(@day, false), - .tm_mon=Int32$from_int(@month, false) - 1, - .tm_year=Int32$from_int(@year, false) - 1900, + .tm_min=Int32ヽfrom_int(@minute, false), + .tm_hour=Int32ヽfrom_int(@hour, false), + .tm_mday=Int32ヽfrom_int(@day, false), + .tm_mon=Int32ヽfrom_int(@month, false) - 1, + .tm_year=Int32ヽfrom_int(@year, false) - 1900, .tm_isdst=-1, }; @@ -154,9 +154,9 @@ struct Time(tv_sec:Int64, tv_usec:Int64; extern) struct tm info = {}; WITH_TIMEZONE(@timezone, localtime_r(&@t.tv_sec, &info)); - info.tm_mday += Int32$from_int(@days, false) + 7*Int32$from_int(@weeks, false); - info.tm_mon += Int32$from_int(@months, false); - info.tm_year += Int32$from_int(@years, false); + info.tm_mday += Int32ヽfrom_int(@days, false) + 7*Int32ヽfrom_int(@weeks, false); + info.tm_mon += Int32ヽfrom_int(@months, false); + info.tm_year += Int32ヽfrom_int(@years, false); time_t t = mktime(&info); (Time){ @@ -169,8 +169,8 @@ struct Time(tv_sec:Int64, tv_usec:Int64; extern) ret : Time? C_code { struct tm info = {.tm_isdst=-1}; - const char *str = Text$as_c_string(@text); - const char *fmt = Text$as_c_string(@format); + const char *str = Textヽas_c_string(@text); + const char *fmt = Textヽas_c_string(@format); if (strstr(fmt, "%Z")) fail("The %Z specifier is not supported for time parsing!"); diff --git a/lib/time/time_defs.h b/lib/time/time_defs.h index 30000983..ae2d009a 100644 --- a/lib/time/time_defs.h +++ b/lib/time/time_defs.h @@ -10,12 +10,12 @@ static INLINE Text_t num_format(long n, const char *unit) { if (n == 0) return Text("now"); - return Text$from_str(String((int64_t)labs(n), " ", unit, (n == -1 || n == 1) ? "" : "s", n <= 0 ? " ago" : " later")); + return Textヽfrom_str(String((int64_t)labs(n), " ", unit, (n == -1 || n == 1) ? "" : "s", n <= 0 ? " ago" : " later")); } static void set_local_timezone(Text_t tz) { - setenv("TZ", Text$as_c_string(tz), 1); + setenv("TZ", Textヽas_c_string(tz), 1); _local_timezone = tz; tzset(); } |
