jl165 merging heads
[LibreOffice.git] / testgraphical / source / timehelper.pm
blob38bd56fc4b20c701edf9e1796402981ee07f1eb0
1 package timehelper;
3 #*************************************************************************
5 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7 # Copyright 2000, 2010 Oracle and/or its affiliates.
9 # OpenOffice.org - a multi-platform office productivity suite
11 # This file is part of OpenOffice.org.
13 # OpenOffice.org is free software: you can redistribute it and/or modify
14 # it under the terms of the GNU Lesser General Public License version 3
15 # only, as published by the Free Software Foundation.
17 # OpenOffice.org is distributed in the hope that it will be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # GNU Lesser General Public License version 3 for more details
21 # (a copy is included in the LICENSE file that accompanied this code).
23 # You should have received a copy of the GNU Lesser General Public License
24 # version 3 along with OpenOffice.org. If not, see
25 # <http://www.openoffice.org/license.html>
26 # for a copy of the LGPLv3 License.
28 #*************************************************************************
30 use POSIX qw(strftime);
31 use POSIX qw(time difftime);
32 # use POSIX qw(localtime);
33 use strict;
34 # use Time::localtime;
35 use loghelper;
37 BEGIN {
38 use Exporter ();
39 our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
41 $VERSION = 1.00;
42 # if using RCS/CVS, this may be preferred
43 $VERSION = do { my @r = (q$Revision: 1.1 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; # must be all one line, for MakeMaker
44 @ISA = qw(Exporter);
45 @EXPORT = qw(&getTime &endTime &printTime &waitAMinute );
46 %EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
47 # your exported package globals go here,
48 # as well as any optionally exported functions
49 @EXPORT_OK = ( ); # qw($Var1 %Hashit &func3);
53 # ------------------------------------------------------------------------------
54 # our $starttime;
55 sub getTime()
57 my $nValue;
58 # $nValue = localtime->sec();
59 # $nValue += 60 * localtime->min();
60 # $nValue += 3600 * localtime->hour();
61 $nValue = time();
62 return $nValue;
64 # sub startTime()
65 # {
66 # $starttime = getTime();
67 # }
68 sub endTime($)
70 my $starttime = shift;
72 my $endtime = getTime();
73 my $nTime = difftime($endtime, $starttime);
74 # my $nTime = $endtime - $starttime;
75 # if ($nTime < 0)
76 # {
77 # $nTime += 24 * 3600; # add 24 hours
78 # }
79 return $nTime;
81 sub printTime($)
83 my $nTime = shift;
84 print( "Time: " . $nTime . " seconds.\n\n");
88 # sub waitAMinute()
89 # {
90 # # _waitInSeconds(20);
91 # # _waitInSeconds(20);
92 # my $now_string = strftime "%a %b %e %H:%M:%S %Y", localtime;
93 # print $now_string . "\n";
94 # # print getCurrentDateString() . "\n";
95 # sleep(60);
96 # }