5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program 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
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 * Author : Boris Mikhailenko <stg34@stargazer.dp.ua>
30 $Date: 2009/08/05 11:40:30 $
38 typedef long suseconds_t;
41 struct UTIME: public timeval
55 UTIME(long long a, long long b)
61 bool operator<(const UTIME & rhs) const
63 if (tv_sec < rhs.tv_sec)
65 else if (tv_sec > rhs.tv_sec)
67 else if (tv_usec < rhs.tv_usec)
72 bool operator<=(const UTIME & rhs) const
74 if (tv_sec < rhs.tv_sec)
76 else if (tv_sec > rhs.tv_sec)
78 else if (tv_usec < rhs.tv_usec)
80 else if (tv_usec > rhs.tv_usec)
85 bool operator>(const UTIME & rhs) const
87 if (tv_sec > rhs.tv_sec)
89 else if (tv_sec < rhs.tv_sec)
91 else if (tv_usec > rhs.tv_usec)
96 bool operator>=(const UTIME & rhs) const
98 if (tv_sec > rhs.tv_sec)
100 else if (tv_sec < rhs.tv_sec)
102 else if (tv_usec > rhs.tv_usec)
104 else if (tv_usec < rhs.tv_usec)
109 bool operator==(const UTIME & rhs) const
111 return (tv_sec == rhs.tv_sec) && (tv_usec == rhs.tv_usec);
114 UTIME operator+(const UTIME & rhs)
118 a = tv_sec + rhs.tv_sec;
119 b = tv_usec + rhs.tv_usec;
128 UTIME operator-(const UTIME & rhs)
132 a = tv_sec - rhs.tv_sec;
133 b = tv_usec - rhs.tv_usec;
142 return UTIME(--a, b + 1000000);
149 return UTIME(++a, 1000000 - b);
158 time_t GetSec() const
163 suseconds_t GetUSec() const
168 double AsDouble() const
170 return tv_sec + tv_usec * 1e-6;