|< 1 2 >| | 14 Einträge, 2 Seiten |
1
2
3
4
5
6
7
sub clock {
my $minutes = shift;
my $hh = floor($minutes/60);
my $rest = $minutes - $hh*60;
if (length($rest) == 1) {$rest = "0".$rest}
return "$hh:$rest";
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#! /usr/bin/perl
use strict;
use warnings;
my $var = -440;
print "renee:\t ",clock_renee($var),"\n";
print "silbersteine: ",clock_silbersteine($var),"\n";
sub clock_renee {
my $minutes = shift;
my $hh = int $minutes/60;
$minutes *= -1 if($minutes < 0);
my $rest = $minutes % 60;
$rest = sprintf("%02d",$rest);
return "$hh:$rest";
}
sub clock_silbersteine{
my $minutes = shift;
my $hh = int($minutes/60);
my $rest = $minutes - $hh*60;
if (length($rest) == 1) {$rest = "0".$rest}
return "$hh:$rest";
}
Quote\n\n~ 7> perl clock.pl
renee: -7:20
silbersteine: -7:-20
1
2
3
4
5
6
7
sub clock {
my $minutes = shift;
my $hh = floor($minutes/60);
my $rest = $minutes - $hh*60;
if (length($rest) == 1) {$rest = "0".$rest}
return "$hh:$rest";
}
1
2
3
4
5
6
7
sub clock {
my $minutes = shift;
my $sign = ($minutes >= 0);
my $hh = int($minutes/60);
my $rest = abs($minutes - $hh*60);
return sprintf ("%s%d:%02d", ($sign ? '' : '-'), $hh, $rest);
}
print "Überstunden = ".clock($jobsum-$skalars{'stdtime'});
1
2
3
4
5
6
7
sub clock {
my $minutes = shift;
my $sign = ($minutes >= 0);
my $hh = int($minutes/60);
my $rest = abs($minutes - $hh*60);
return sprintf ("%s%d:%02d", ($sign ? '' : '-'), $hh, $rest);
}
1
2
3
4
5
6
7
8
9
10
11
12
13
D:\Eigene Dateien\Entwicklung\RFC>perl
sub clock {
my $minutes = shift;
my $sign = ($minutes >= 0);
my $hh = int($minutes/60);
my $rest = abs($minutes - $hh*60);
return sprintf ("%s%d:%02d", ($sign ? '' : '-'), $hh, $rest);
}
$jobsum=0;
$skalars{'stdtime'}=440;
print "Überstunden = ".clock($jobsum-$skalars{'stdtime'});
^Z
Überstunden = --7:20
1
2
3
4
5
6
sub clock {
my $minutes = shift;
my $hh = int($minutes/60);
my $rest = abs($minutes - $hh*60);
return sprintf ("%d:%02d", $hh, $rest);
}
1
2
3
4
5
6
7
8
sub clock_bugfix {
my $minutes = shift;
my $sign = ($minutes >= 0);
my $hh = int($minutes/60);
my $rest = abs($minutes - $hh*60);
$hh *= -1 if($hh < 0);
return sprintf ("%s%d:%02d", ($sign ? '' : '-'), $hh, $rest);
}
|< 1 2 >| | 14 Einträge, 2 Seiten |