~tomterl/public-inbox

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH thp] +moon: build using recent Hare

Carlos Une <une@fastmail.fm>
Details
Message ID
<20230427015627.12147-1-une@fastmail.fm>
DKIM signature
missing
Download raw message
Patch: +2 -3
---
 mods/+moon.ha | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/mods/+moon.ha b/mods/+moon.ha
index 6a86fe7..3a01132 100644
--- a/mods/+moon.ha
+++ b/mods/+moon.ha
@@ -22,7 +22,7 @@ type hemisphere = enum {Southern, Northern};
fn moon_phase(dt: datetime::datetime, hemisphere: hemisphere) str = {
	// Use a known New Moon datetime as reference (January 21, 2023, 20:53 UTC)
	const ref_new_moon = datetime::new(time::chrono::UTC, 0, 2023, 1, 21, 20, 53, 0, 0)!;
	const secs = datetime::unitdiff(dt, ref_new_moon, datetime::unit::SECOND): f64;
	const secs = (chrono::diff(&ref_new_moon, &dt)! / time::SECOND): f64;
	const T = 29.53059; // Average synodic period of the Moon
	const Tsecs = T * 86400.0;
	const phase = math::modf64(secs, Tsecs)/Tsecs;
@@ -39,6 +39,5 @@ export fn mod_moon(pe: *env::env) str = {
	case "N" => yield hemisphere::Northern;
	case => return strings::dup("+moon.hemisphere:config error");
	};
	const now_utc = datetime::in(time::chrono::UTC, datetime::now());
	return strings::dup(moon_phase(now_utc, hemisphere));
	return strings::dup(moon_phase(datetime::nowutc(), hemisphere));
};
-- 
2.30.2
Details
Message ID
<878recscga.fsf@tomsdiner.org>
In-Reply-To
<20230427015627.12147-1-une@fastmail.fm> (view parent)
DKIM signature
missing
Download raw message
Thanks!
Reply to thread Export thread (mbox)