[Remind-Fans] dawn,sunrise,sunset, dusk -- solar_noon??

Tim Chase remind at tim.thechases.com
Sat Oct 10 10:38:29 EDT 2020


On 2020-10-10 06:01, remind-fans at trodman.com wrote:
> Thanks for 
> 
>     dusk([dq_date]) and dawn(),sunrise(),sunset()
> 
> How about adding
> 
>     noon_solar() ?
> 
> Right now, might I be able to do the math all in remind, and bisect
> the sunrise(),sunset() interval?

Indeed, you can do all the math in Remind, exactly as you describe by
bisecting sunrise & sunset.  The only trick is that Remind doesn't
like to add or divide TIME types, so you have to convert them to the
minute-of-the-day, average/bisect them, and then convert it back to a
time.  But once you know that, writing such an FSET to create
noon_solar() isn't too bad:

  FSET tomins(t) (hour(t) * 60) + minute(t)
  FSET frommins(i) time(i / 60, i % 60)
  FSET noon_solar(dt) frommins(( \
    tomins(sunrise(dt)) + tomins(sunset(dt)) \
    ) / 2)

  MSG %"Solar noon: [noon_solar($T)]%"%

Hope this helps,

-tim




More information about the Remind-fans mailing list