Refactored time_to_decimal for clarity.
authorNik Okuntseff <support@anuko.com>
Wed, 6 Apr 2016 18:16:48 +0000 (18:16 +0000)
committerNik Okuntseff <support@anuko.com>
Wed, 6 Apr 2016 18:16:48 +0000 (18:16 +0000)
WEB-INF/lib/common.lib.php
WEB-INF/templates/footer.tpl

index d98e888..167b95b 100644 (file)
                }
        }
 
-function time_to_decimal($a) {
+// time_to_decimal converts a time string such as 1:15 to its decimal representation such as 1.25 or 1,25.
+function time_to_decimal($val) {
   global $user;
-  $tmp = explode(":", $a);
-  if($tmp[1]{0}=="0") $tmp[1] = $tmp[1]{1};
+  $parts = explode(':', $val); // parts[0] is hours, parts[1] is minutes.
 
-  $m = round($tmp[1]*100/60);
+  $minutePercent = round($parts[1]*100/60); // Integer value (0-98) of percent of minutes portion in the hour.
+  if($minutePercent < 10) $minutePercent = '0'.$minutePercent; // Pad small values with a 0 to always have 2 digits.
 
-  if($m<10) $m = "0".$m;
-  $time = $tmp[0].$user->decimal_mark.$m;
-  return $time;
+  $decimalTime = $parts[0].$user->decimal_mark.$minutePercent; // Construct decimal representation of time value.
+
+  return $decimalTime;
 }
 
 function sec_to_time_fmt_hm($sec)
index f15d95d..6921dfc 100644 (file)
@@ -12,7 +12,7 @@
       <br>
       <table cellspacing="0" cellpadding="4" width="100%" border="0">
         <tr>
-          <td align="center">&nbsp;Anuko Time Tracker 1.9.25.3496 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+          <td align="center">&nbsp;Anuko Time Tracker 1.9.25.3497 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
             <a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
             <a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
             <a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>