root/trunk/libffado/src/libutil/SystemTimeSource.h

Revision 1568, 1.6 kB (checked in by holin, 14 years ago)

gcc 4.4 fixes (r1566, r1567, DICE) to trunk

Line 
1 /*
2  * Copyright (C) 2005-2008 by Pieter Palmers
3  *
4  * This file is part of FFADO
5  * FFADO = Free Firewire (pro-)audio drivers for linux
6  *
7  * FFADO is based upon FreeBoB.
8  *
9  * This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 2 of the License, or
12  * (at your option) version 3 of the License.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
21  *
22  */
23
24 #ifndef __FFADO_SYSTEMTIMESOURCE__
25 #define __FFADO_SYSTEMTIMESOURCE__
26
27 #include "../debugmodule/debugmodule.h"
28
29 #include <stdint.h>
30
31 typedef uint64_t ffado_microsecs_t;
32
33 namespace Util {
34
35 class SystemTimeSource
36 {
37 private: // don't allow objects to be created
38     SystemTimeSource() {};
39     virtual ~SystemTimeSource() {};
40
41 public:
42     static ffado_microsecs_t getCurrentTime();
43     static ffado_microsecs_t getCurrentTimeAsUsecs();
44
45     static void SleepUsecRelative(ffado_microsecs_t usecs);
46     static void SleepUsecAbsolute(ffado_microsecs_t wake_time);
47    
48     /**
49      * @brief sleeps for a random amount of usecs
50      * @param max_usec max usecs
51      * @return number of usecs slept
52      */
53     static ffado_microsecs_t SleepUsecRandom(ffado_microsecs_t max_usec);
54 };
55
56 } // end of namespace Util
57
58 #endif /* __FFADO_SYSTEMTIMESOURCE__ */
59
60
Note: See TracBrowser for help on using the browser.