diff --git a/CHANGELOG.md b/CHANGELOG.md index dc95198..9268e40 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +2026.07.20 – Add pi() to !calc. + +- Added `pi()` function support to `!calc`: bc -l does not define `pi()` on all systems, so `cmd_calc` now prepends a `pi()` definition before evaluating expressions. `!calc pi()`, `!calc pi()*2`, `!calc pi()^2` etc. all work. +- Version bumped to 0.35.3. + 2026.07.20 – Fix !time timezone conversion bug. - Fixed `!time` command: `setenv("TZ",...) + localtime()` was not reliably converting to the requested timezone. Replaced with `TZ=... date` via `popen()`, which handles all IANA timezone names correctly (e.g. `!time Australia/Sydney` now shows 11:15 AEST instead of UTC). diff --git a/zynk.c b/zynk.c index ddfb54e..ea34bb3 100644 --- a/zynk.c +++ b/zynk.c @@ -29,7 +29,7 @@ int asprintf(char **, const char *, ...); /* ---- constants ---- */ -#define VERSION "0.35.2" +#define VERSION "0.35.3" #define DEFAULT_SERVER "irc.libera.chat" #define OPENCODE_BIN "/usr/bin/opencode" #define CLR_RESET "\033[0m" @@ -2583,6 +2583,8 @@ static int cmd_calc(Session *s, const char *msg, const char *reply_target, const } close(in_pipe[0]); close(out_pipe[1]); + const char *pidef = "define pi() { return 3.14159265358979323844; }\n"; + write(in_pipe[1], pidef, strlen(pidef)); write(in_pipe[1], rest, strlen(rest)); write(in_pipe[1], "\n", 1); close(in_pipe[1]);