summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoru <@>2026-03-22 15:08:52 +0200
committeru <@>2026-03-22 15:08:52 +0200
commit47e4c456590b9846612bdc1db83756e7b546f9a2 (patch)
tree5512865382f1cafa885c4b2616f85295b9071b2e /src
parent07c82be91778003f43d064ea544235d31a785101 (diff)
a
Diffstat (limited to 'src')
-rw-r--r--src/.dateparse.rs.kate-swpbin0 -> 940 bytes
-rw-r--r--src/dateparse.rs7
-rw-r--r--src/lib.rs9
-rw-r--r--src/solar.rs8
4 files changed, 12 insertions, 12 deletions
diff --git a/src/.dateparse.rs.kate-swp b/src/.dateparse.rs.kate-swp
new file mode 100644
index 0000000..9941da4
--- /dev/null
+++ b/src/.dateparse.rs.kate-swp
Binary files differ
diff --git a/src/dateparse.rs b/src/dateparse.rs
index 42fd214..46a8689 100644
--- a/src/dateparse.rs
+++ b/src/dateparse.rs
@@ -11,27 +11,20 @@ macro_rules! A {
#[must_use]
pub fn dateparse(s: &str) -> Option<(usize, usize, usize)> {
- // inf and sup for indiv. values
A![LO; b"00/00/00", [0; 8]];
A![HI; b"19/39/99", [0xFF; 8]];
A![INTMSK; [b'0'; 16]];
A![SLHMSK; [b'/'; 16]];
- // as_flattened wont work with concat_bytes!()
- // m m / d d / y y
A![NUMMSK; [10, 1, 0], [10, 1, 0], [10, 1], [0; 8]];
let b = s.as_bytes();
let v = V::load_or_default(b);
let mut valid = true;
- // index 16 for swizzles with INTMSK is b'0'
- // index 15 is \0
- // this will compile to a shuffle, but a relaxed_laneselect would be cool
const Z: usize = 16;
const N: usize = 15;
macro_rules! X { [$($b: expr),+] => {
simd_swizzle!(v, INTMSK, [$($b),+, N, N, N, N, N, N, N, N])
// [b'0'; 16] we need better syntax for this
}; }
- // normalize values by filling blanks, find through indexes of slashes
let mut v = match (b.len(), v.simd_eq(SLHMSK).to_bitmask()) {
// yy/d/m -> '0' m / '0' d / y y
(6, 0b001010) => X![Z, 0, 1, Z, 2, 3, 4, 5],
diff --git a/src/lib.rs b/src/lib.rs
index 6b28e00..9f7f540 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -94,6 +94,8 @@ async fn fetch(req: Request, env: Env, _ctx: Context) -> Result<Response> {
". Source available "
a href="https://git.neetlo.li/ataxia/tree" { "here" }
"."
+ br; br;
+ "I may be contacted by shouting loudly on the Internet, though I doubt there would be a need to."
}
})
})
@@ -198,7 +200,12 @@ body {
max-width: 960px;
margin-left: auto;
margin-right: auto;
-}";
+}
+.f,.f *{position:fixed;height:100%;top:0;left:50%}
+.f *{transform:translate(-50%,0)}
+.f{display:none;left:0;width:100%;background:rgba(0,0,0,0.8)}
+*:focus+.f{display:block}
+";
html! {
(DOCTYPE)
style { (PreEscaped(css)) }
diff --git a/src/solar.rs b/src/solar.rs
index b8e146b..dfe357c 100644
--- a/src/solar.rs
+++ b/src/solar.rs
@@ -95,11 +95,11 @@ macro_rules! JD {
fn compute_ang(jd: f64) -> f64 {
let T = (jd - 2451545.) / 36525.;
let Lmean = (280.46646 + (36000.76983 * T) + (0.0003032 * T * T)) % 360.;
- let M = (357.52911 + (35999.05029 * T) - (0.0001537 * T * T)) % 360.;
+ let M = ((357.52911 + (35999.05029 * T) - (0.0001537 * T * T)) % 360.).to_radians();
let C = ((1.914602 - (0.004817 * T) - (0.000014 * T * T))
- * (M.to_radians()).sin())
- + ((0.019993 - (0.000101 * T)) * (2. * M.to_radians()).sin())
- + (0.000289 * (3. * M.to_radians()).sin());
+ * M.sin())
+ + ((0.019993 - (0.000101 * T)) * (2. * M).sin())
+ + (0.000289 * (3. * M).sin());
let Ltrue = Lmean + C;
Ltrue - 0.00569 - (0.00478 * ((125.04 - 1934.136 * T).to_radians()).sin())
}