Template:Moons/today: Difference between revisions

From A KoL Wiki
imported>Flargen
m cat
imported>Xyzzyn
Use Unix timestamp difference to compute this value, accounting for the time difference between midnight UTC and rollover. Make including templates show precise values just before rollover (I hope).
 
Line 1: Line 1:
{{#expr:
{{#expr:((({{#time:U}}-1149046260)/86400)-0.5)round0}}<noinclude>
    {{CURRENTDAY}}
  + {{#switch:{{CURRENTMONTH}}|01=0|02=31|03=59|04=90|05=120|06=151|07=181|08=212|09=243|10=273|11=304|12=334}}
  + ({{CURRENTYEAR}} - 2000) * 365
  + ((({{CURRENTYEAR}} - 2002) / 4) round 0)
  - (({{CURRENTYEAR}} mod 4 = 0) and (({{CURRENTMONTH}} = 01) or ({{CURRENTMONTH}} = 02)))
  - 2342
}}<noinclude>
----
----
This evaluates the number of days since the start of June, 2006 - a day which was conveniently "1" on all three phases of the moons:{{moon|1|1|1}}Note that it may be a little bit off, as server time does not appear to line up exactly with KoL time (it appears to be an hour behind - ie this will change an hour after rollover). The server currently believes it to be {{CURRENTDAY}} {{CURRENTMONTHNAME}}, {{CURRENTYEAR}}.
This evaluates the number of days since May 31 2006 03:31 UTC, one day before all three phases of the moons were ‘1’: {{moon|1|1|1}}
 
The constant 1149046260 is obtained via
:<nowiki>{{#time: U|2006-05-31 03:31 UTC}}</nowiki>
and 86400 is the number of seconds in one day (discarding [[:wikipedia:leap second|leap second]]s). The rest of the code takes care of truncating fractional results.


[[Category:Utility Templates|{{PAGENAME}}]]
[[Category:Utility Templates|{{PAGENAME}}]]
</noinclude>
</noinclude>

Latest revision as of 21:27, 5 January 2011

7039


This evaluates the number of days since May 31 2006 03:31 UTC, one day before all three phases of the moons were ‘1’:

The constant 1149046260 is obtained via

{{#time: U|2006-05-31 03:31 UTC}}

and 86400 is the number of seconds in one day (discarding leap seconds). The rest of the code takes care of truncating fractional results.