Files
glib/docs/reference/glib/tmpl/timers.sgml
Owen Taylor 2ae1a46b4c Add g_object_add/remove_toggle_ref() functions to get notification when a
2005-05-05  Owen Taylor  <otaylor@redhat.com>

        * gobject.[ch] gobject.symbols: Add
        g_object_add/remove_toggle_ref() functions to get notification
        when a reference count is the last remaining reference; this
        enables better memory management for language bindings.
        (http://mail.gnome.org/archives/gtk-devel-list/2005-April/msg00095.html)

2005-05-05  Owen Taylor  <otaylor@redhat.com>

        * glib/gdataset.[ch] glib/gdatasetprivate.h: Add
        g_datalist_set/unset_flags(), g_datalist_get_flags() functions
        to squeeze some bits into a GDataSet... this is needed for
        efficient implementation of toggle references in GObject.

        * tests/gobject/references.c tests/gobject/Makefile.am:
        Add a test case for weak and toggle references.

        * glib/gfileutils.[ch]: Rename g_file_replace() back
        to g_file_set_contents().

        * glib/glib.symbols: Update.

2005-05-05  Owen Taylor  <otaylor@redhat.com>

        * glib/Makefile.am glib/glib-sections.txt gobject/gobject-sections.txt:
        Update

        * gobject/tmpl/objects.sgml: Document toggle-references.
2005-05-05 14:57:29 +00:00

103 lines
2.5 KiB
Plaintext

<!-- ##### SECTION Title ##### -->
Timers
<!-- ##### SECTION Short_Description ##### -->
keep track of elapsed time.
<!-- ##### SECTION Long_Description ##### -->
<para>
#GTimer records a start time, and counts microseconds elapsed since that time.
This is done somewhat differently on different platforms, and can be tricky to
get exactly right, so #GTimer provides a portable/convenient interface.
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
</para>
<!-- ##### SECTION Stability_Level ##### -->
<!-- ##### STRUCT GTimer ##### -->
<para>
Opaque datatype that records a start time.
</para>
<!-- ##### FUNCTION g_timer_new ##### -->
<para>
Creates a new timer, and starts timing (i.e. g_timer_start() is implicitly
called for you).
</para>
@Returns: a new #GTimer.
<!-- ##### FUNCTION g_timer_start ##### -->
<para>
Marks a start time, so that future calls to g_timer_elapsed() will report the
time since g_timer_start() was called. g_timer_new() automatically marks the
start time, so no need to call g_timer_start() immediately after creating the
timer.
</para>
@timer: a #GTimer.
<!-- ##### FUNCTION g_timer_stop ##### -->
<para>
Marks an end time, so calls to g_timer_elapsed() will return the difference
between this end time and the start time.
</para>
@timer: a #GTimer.
<!-- ##### FUNCTION g_timer_continue ##### -->
<para>
Resumes a timer that has previously been stopped with g_timer_stop().
g_timer_stop() must be called before using this function.
</para>
@timer: a #GTimer.
@Since: 2.4
<!-- ##### FUNCTION g_timer_elapsed ##### -->
<para>
If @timer has been started but not stopped, obtains the time since the timer was
started. If @timer has been stopped, obtains the elapsed time between the time
it was started and the time it was stopped. The return value is the number of
seconds elapsed, including any fractional part. The @microseconds
out parameter is essentially useless.
</para>
@timer: a #GTimer.
@microseconds: fractional part of seconds elapsed, in microseconds
(that is, the total number of microseconds elapsed, modulo
1000000)
@Returns: seconds elapsed as a floating point value, including
any fractional part.
<!-- ##### FUNCTION g_timer_reset ##### -->
<para>
This function is useless; it's fine to call g_timer_start() on an
already-started timer to reset the start time, so g_timer_reset() serves no
purpose.
</para>
@timer: a #GTimer.
<!-- ##### FUNCTION g_timer_destroy ##### -->
<para>
Destroys a timer, freeing associated resources.
</para>
@timer: a #GTimer to destroy.