Expansion of LEAPS_THRU_END_OF (now my hands hurt)
git-svn-id: svn://svn.c3d2.de/c3d2-web/branches/toidinamais_coole_scheisse@64 31f61c52-7bfb-0310-b897-fc00f8a278f0
This commit is contained in:
parent
c7f0e8adc7
commit
48dfe6ca5b
|
@ -59,11 +59,59 @@ Von toidinamai übersetzt nach XSL.
|
|||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
|
||||
<!--
|
||||
#define DIV(a, b) ((a) / (b) - ((a) % (b) < 0))
|
||||
#define LEAPS_THRU_END_OF(y) (DIV (y, 4) - DIV (y, 100) + DIV (y, 400))
|
||||
-->
|
||||
<xsl:variable name="leapsyearguessed">
|
||||
<xsl:variable name="mod1">
|
||||
<xsl:choose>
|
||||
<xsl:when test="($yearguessed - 1) mod 4 < 0">1</xsl:when>
|
||||
<xsl:otherwise>0</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="mod2">
|
||||
<xsl:choose>
|
||||
<xsl:when test="($yearguessed - 1) mod 100 < 0">1</xsl:when>
|
||||
<xsl:otherwise>0</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="mod3">
|
||||
<xsl:choose>
|
||||
<xsl:when test="($yearguessed - 1) mod 400 < 0">1</xsl:when>
|
||||
<xsl:otherwise>0</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<xsl:value-of select="(floor(($yearguessed - 1) div 4) - $mod1) - (floor(($yearguessed - 1) div 100) - $mod2) + (floor(($yearguessed - 1) div 400) - $mod3)"/>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="leapsyear">
|
||||
<xsl:variable name="mod1">
|
||||
<xsl:choose>
|
||||
<xsl:when test="($year - 1) mod 4 < 0">1</xsl:when>
|
||||
<xsl:otherwise>0</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="mod2">
|
||||
<xsl:choose>
|
||||
<xsl:when test="($year - 1) mod 100 < 0">1</xsl:when>
|
||||
<xsl:otherwise>0</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="mod3">
|
||||
<xsl:choose>
|
||||
<xsl:when test="($year - 1) mod 400 < 0">1</xsl:when>
|
||||
<xsl:otherwise>0</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<xsl:value-of select="(floor(($year - 1) div 4) - $mod1) - (floor(($year - 1) div 100) - $mod2) + (floor(($year - 1) div 400) - $mod3)"/>
|
||||
</xsl:variable>
|
||||
|
||||
<!-- Adjust DAYS and Y to match the guessed year. -->
|
||||
<xsl:variable name="daysadjusted">
|
||||
<xsl:value-of select="(($yearguessed - $year) * 365
|
||||
+ LEAPS_THRU_END_OF (yearguessed - 1)
|
||||
- LEAPS_THRU_END_OF (y - 1) )" />
|
||||
+ $leapsyearguessed
|
||||
- $leapsyear)" />
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:choose>
|
||||
|
|
Loading…
Reference in New Issue
Block a user