Skip to content

Commit

Permalink
Larger steps on minutes when printing times - see bug 912
Browse files Browse the repository at this point in the history
  • Loading branch information
moodler committed Dec 8, 2003
1 parent 04fb8cf commit 6942583
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/weblib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1522,18 +1522,21 @@ function print_date_selector($day, $month, $year, $currenttime=0) {
choose_from_menu($years, $year, $currentdate['year'], "");
}

function print_time_selector($hour, $minute, $currenttime=0) {
function print_time_selector($hour, $minute, $currenttime=0, $step=5) {
// Currenttime is a default timestamp in GMT
// Prints form items with the names $hour and $minute

if (!$currenttime) {
$currenttime = time();
}
$currentdate = usergetdate($currenttime);
if ($step != 1) {
$currentdate['minutes'] = ceil($currentdate['minutes']/$step)*$step;
}
for ($i=0; $i<=23; $i++) {
$hours[$i] = sprintf("%02d",$i);
}
for ($i=0; $i<=59; $i++) {
for ($i=0; $i<=59; $i+=$step) {
$minutes[$i] = sprintf("%02d",$i);
}
choose_from_menu($hours, $hour, $currentdate['hours'], "");
Expand Down

0 comments on commit 6942583

Please sign in to comment.