timeval_decls.h

00001 /*
00002  *  Copyright (C) 2006  Helmut Grohne
00003  *
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU General Public License
00015  *  along with this program; if not, write to the Free Software
00016  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017  */
00018 
00019 #ifndef LIBMUTH_TIMEVAL_DECLS_H
00020 #define LIBMUTH_TIMEVAL_DECLS_H
00021 
00022 #include <time.h>
00023 #ifndef __WIN32__
00024 #include <sys/time.h>
00025 #else
00026 #include "win32.h"
00027 #include <sys/timeb.h>
00028 #include <sys/types.h>
00029 #endif
00030 
00031 #define TimevalNow ((void*)0)
00032 
00036 class Timeval : public timeval{
00037         public:
00041                 Timeval();
00048                 Timeval(const timeval &o);
00054                 Timeval(void*);
00059                 Timeval(time_t sec);
00065                 Timeval(time_t sec, suseconds_t usec);
00070                 Timeval(float sec);
00075                 Timeval(double sec);
00082                 Timeval &operator=(const timeval &o);
00088                 Timeval &operator=(time_t sec);
00094                 Timeval &operator=(float sec);
00100                 Timeval &operator=(double sec);
00104                 void gettimeofday();
00109                 operator time_t() const;
00114                 operator float() const;
00119                 operator double() const;
00125                 unsigned int milliseconds() const;
00131                 bool operator>(const timeval &o) const;
00137                 bool operator>=(const timeval &o) const;
00144                 bool operator==(const timeval &o) const;
00150                 bool operator<=(const timeval &o) const;
00156                 bool operator<(const timeval &o) const;
00163                 bool operator!=(const timeval &o) const;
00170                 Timeval operator+(const timeval &o) const;
00177                 Timeval operator+(time_t sec) const;
00184                 Timeval operator+(float sec) const;
00191                 Timeval operator+(double sec) const;
00198                 Timeval &operator+=(const timeval &o);
00204                 Timeval &operator+=(time_t sec);
00210                 Timeval &operator+=(float sec);
00216                 Timeval &operator+=(double sec);
00223                 Timeval operator-(const timeval &o) const;
00231                 Timeval operator-(time_t sec) const;
00239                 Timeval operator-(float sec) const;
00247                 Timeval operator-(double sec) const;
00254                 Timeval &operator-=(const timeval &o);
00260                 Timeval &operator-=(time_t sec);
00266                 Timeval &operator-=(float sec);
00272                 Timeval &operator-=(double sec);
00273 };
00274 
00275 #endif

Generated on Thu Feb 14 13:30:30 2008 by  doxygen 1.5.1