1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
4 * Moonlight List (moonlight-list@lists.ximian.com)
6 * Copyright 2007 Novell, Inc. (http://www.novell.com)
8 * See the LICENSE file included with the distribution for details.
12 #ifndef MOON_TIMESOURCE_H
13 #define MOON_TIMESOURCE_H
17 #include "deployment.h"
19 #define MOON_PRIORITY_HIGH G_PRIORITY_DEFAULT
20 #define MOON_PRIORITY_DEFAULT G_PRIORITY_DEFAULT_IDLE
21 #define MOON_PRIORITY_IDLE G_PRIORITY_DEFAULT_IDLE
23 class TimeSource
: public EventObject
{
25 virtual ~TimeSource ();
29 TimeSource (Deployment
*deployment
);
31 virtual void Start ();
33 virtual void SetTimerFrequency (int timeout
);
35 virtual TimeSpan
GetNow ();
37 const static int TickEvent
;
40 class SystemTimeSource
: public TimeSource
{
42 virtual ~SystemTimeSource ();
46 SystemTimeSource (Deployment
*deployment
);
48 virtual void Start ();
50 virtual void SetTimerFrequency (int timeout
);
52 virtual TimeSpan
GetNow ();
57 static gboolean
tick_timeout (gpointer data
);
60 class ManualTimeSource
: public TimeSource
{
62 virtual ~ManualTimeSource ();
67 virtual TimeSpan
GetNow ();
69 void SetCurrentTime (TimeSpan current_time
);
72 TimeSpan current_time
;
77 /* useful for timing things */
78 TimeSpan
get_now (void);
82 #endif /* MOON_TIMESOURCE_H */