summaryrefslogtreecommitdiff
path: root/src/main/resources/templates/macros/hms.ftl
diff options
context:
space:
mode:
authorJesse Morgan <jesse@jesterpm.net>2016-04-09 15:53:24 -0700
committerJesse Morgan <jesse@jesterpm.net>2016-04-09 15:53:24 -0700
commit371ccae3d1f31ec38f4af77fb7fcd175d49b3cd5 (patch)
tree38c4f1e8828f9af9c4b77a173bee0d312b321698 /src/main/resources/templates/macros/hms.ftl
parentbbf907e51dfcf157bdee24dead1d531122aa25db (diff)
parent3102d8bce3426d9cf41aeaf201c360d342677770 (diff)
Merge pull request #10 from PuyallupFoursquare/maven
Switching from Ivy+Ant to Maven.
Diffstat (limited to 'src/main/resources/templates/macros/hms.ftl')
-rw-r--r--src/main/resources/templates/macros/hms.ftl25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/main/resources/templates/macros/hms.ftl b/src/main/resources/templates/macros/hms.ftl
new file mode 100644
index 0000000..339b8a9
--- /dev/null
+++ b/src/main/resources/templates/macros/hms.ftl
@@ -0,0 +1,25 @@
+<#macro hms seconds>
+ <#assign h = (seconds / 3600)?int />
+ <#assign m = (seconds % 3600 / 60)?int />
+ <#assign s = (seconds % 3600 % 60)?int />
+
+ <#if (h < 10)>
+ <#assign h = "0${h}" />
+ </#if>
+
+ <#if (m < 10)>
+ <#assign m = "0${m}" />
+ </#if>
+
+ <#if (s < 10)>
+ <#assign s = "0${s}" />
+ </#if>
+
+ <#if (seconds >= 3600)>
+ ${h}:${m}:${s}
+ <#elseif (seconds >= 60)>
+ ${m}:${s}
+ <#else>
+ ${s} seconds
+ </#if>
+</#macro>