Corrected wrong libdatetime.pc.in file.
[libdatetime.git] / src / Time.cxx
blobd0d087376aab3506567c0a6c0fb95ef9fbcdb67e
1 /*{{{ LICENCE
3 * libdatetime
4 * Copyright (C) 2009 Andreas Waidler <arandes@programmers.at>
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
10 * THE SOFTWARE IS PROVIDED AS IS AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 *}}}*/
20 #include <libdatetime/Time.hxx>
22 namespace libdatetime
24 Time::Time(unsigned int seconds)/*{{{*/
25 : _totalSeconds(seconds)
26 , _hours(0)
27 , _minutes(0)
28 , _seconds(seconds)
30 _hours = _seconds / (60 * 60);
31 _seconds -= _hours * 60 * 60;
33 _minutes = _seconds / 60;
34 _seconds -= _minutes * 60;
37 /*}}}*/
38 unsigned int Time::hours() const/*{{{*/
40 return _hours;
43 /*}}}*/
44 unsigned int Time::minutes() const/*{{{*/
46 return _minutes;
49 /*}}}*/
50 unsigned int Time::seconds() const/*{{{*/
52 return _seconds;
55 /*}}}*/
56 Time::operator int() const/*{{{*/
58 return _totalSeconds;
61 /*}}}*/
64 // Use no tabs at all; two spaces indentation; max. eighty chars per line.
65 // vim: et ts=2 sw=2 sts=2 tw=80 fdm=marker