I've no idea here...
[gtkD.git] / src / glib / Timer.d
blob3cf3ed7c56bbb11323b534310bed742313f2b7cc
1 /*
2 * This file is part of duit.
4 * duit is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * duit is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with duit; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = glib-Timers.html
26 * outPack = glib
27 * outFile = Timer
28 * strct = GTimer
29 * realStrct=
30 * ctorStrct=
31 * clss = Timer
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - g_timer
40 * omit structs:
41 * omit prefixes:
42 * omit code:
43 * imports:
44 * structWrap:
45 * - GTimer* -> Timer
46 * local aliases:
49 module glib.Timer;
51 private import glib.glibtypes;
53 private import lib.glib;
56 /**
57 * Description
58 * GTimer records a start time, and counts microseconds elapsed since that time.
59 * This is done somewhat differently on different platforms, and can be tricky to
60 * get exactly right, so GTimer provides a portable/convenient interface.
62 public class Timer
65 /** the main Gtk struct */
66 protected GTimer* gTimer;
69 public GTimer* getTimerStruct()
71 return gTimer;
75 /** the main Gtk struct as a void* */
76 protected void* getStruct()
78 return cast(void*)gTimer;
81 /**
82 * Sets our main struct and passes it to the parent class
84 public this (GTimer* gTimer)
86 this.gTimer = gTimer;
89 /**
93 /**
94 * Creates a new timer, and starts timing (i.e. g_timer_start() is implicitly
95 * called for you).
96 * Returns:
97 * a new GTimer.
99 public static Timer _New()
101 // GTimer* g_timer_new (void);
102 return new Timer( g_timer_new() );
106 * Marks a start time, so that future calls to g_timer_elapsed() will report the
107 * time since g_timer_start() was called. g_timer_new() automatically marks the
108 * start time, so no need to call g_timer_start() immediately after creating the
109 * timer.
110 * timer:
111 * a GTimer.
113 public void _Start()
115 // void g_timer_start (GTimer *timer);
116 g_timer_start(gTimer);
120 * Marks an end time, so calls to g_timer_elapsed() will return the difference
121 * between this end time and the start time.
122 * timer:
123 * a GTimer.
125 public void _Stop()
127 // void g_timer_stop (GTimer *timer);
128 g_timer_stop(gTimer);
132 * Resumes a timer that has previously been stopped with g_timer_stop().
133 * g_timer_stop() must be called before using this function.
134 * timer:
135 * a GTimer.
136 * Since 2.4
138 public void _Continue()
140 // void g_timer_continue (GTimer *timer);
141 g_timer_continue(gTimer);
145 * If timer has been started but not stopped, obtains the time since the timer was
146 * started. If timer has been stopped, obtains the elapsed time between the time
147 * it was started and the time it was stopped. The return value is the number of
148 * seconds elapsed, including any fractional part. The microseconds
149 * out parameter is essentially useless.
150 * timer:
151 * a GTimer.
152 * microseconds:
153 * return location for the fractional part of seconds elapsed,
154 * in microseconds (that is, the total number of microseconds elapsed, modulo
155 * 1000000), or NULL
156 * Returns:
157 * seconds elapsed as a floating point value, including
158 * any fractional part.
160 public double _Elapsed(uint* microseconds)
162 // gdouble g_timer_elapsed (GTimer *timer, gulong *microseconds);
163 return g_timer_elapsed(gTimer, microseconds);
167 * This function is useless; it's fine to call g_timer_start() on an
168 * already-started timer to reset the start time, so g_timer_reset() serves no
169 * purpose.
170 * timer:
171 * a GTimer.
173 public void _Reset()
175 // void g_timer_reset (GTimer *timer);
176 g_timer_reset(gTimer);
180 * Destroys a timer, freeing associated resources.
181 * timer:
182 * a GTimer to destroy.
184 public void _Destroy()
186 // void g_timer_destroy (GTimer *timer);
187 g_timer_destroy(gTimer);