X-Boost
2.3.8
Main Page
Related Pages
Classes
Files
File List
File Members
include
Utility
Time.h
1
/* XBoost: Ada-Boost and Friends on Haar/ICF/HOG Features, Library and ToolBox
2
*
3
* Copyright (c) 2008-2014 Paolo Medici <medici@ce.unipr.it>
4
*
5
* This library is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU Lesser General Public
7
* License as published by the Free Software Foundation; either
8
* version 2 of the License, or (at your option) any later version.
9
*
10
* This library is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* Lesser General Public License for more details.
14
*
15
* You should have received a copy of the GNU Lesser General Public
16
* License along with this library; if not, write to the
17
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18
* Boston, MA 02111-1307, USA.
19
*/
20
21
#ifndef _TIME_UTILITY_H
22
#define _TIME_UTILITY_H
23
24
#include <iostream>
25
26
class
human_readable_time
{
27
int
s;
28
public
:
29
human_readable_time
(
int
_s) : s(_s) { }
30
31
int
getTime()
const
{
return
s; }
32
};
33
34
std::ostream & operator << (std::ostream & o,
const
human_readable_time
& t)
35
{
36
if
(t.getTime() < 60)
37
o << t.getTime() <<
" secs"
;
38
else
39
if
(t.getTime() < 3600)
40
o << t.getTime()/60 <<
" mins and "
<< t.getTime()%60 <<
" secs"
;
41
else
42
o << t.getTime()/3600 <<
" hours and "
<< (t.getTime()/60)%60 <<
" mins"
;
43
44
return
o;
45
}
46
47
#endif
human_readable_time
Definition:
Time.h:26
Generated on Wed Jul 30 2014 18:01:13 for X-Boost by
1.8.7