Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

tm.h File Reference


Detailed Description

Time manipulation and caching routines.

Author:
Raphael Manfredi
Date:
2003-2005

#include "common.h"

Go to the source code of this file.

Defines

#define tm_zero(t)   ((t)->tv_sec == 0 && (t)->tv_usec == 0)
 tm_zero

#define tm2f(t)   ((double) (t)->tv_sec + (t)->tv_usec / 1000000.0)
 tm2f

#define tm2ms(t)   ((t)->tv_sec * 1000 + (t)->tv_usec / 1000)
 tm2ms


Typedefs

typedef GTimeVal tm_t

Functions

void f2tm (double t, tm_t *tm)
 Convert floating point time description into a struct timeval by filling in the supplied structure.

void tm_elapsed (tm_t *elapsed, const tm_t *last, const tm_t *old)
 Computes the elapsed time (last - old) in the supplied structure.

void tm_sub (tm_t *tm, const tm_t *dec)
 In-place substract dec from tm.

void tm_add (tm_t *tm, const tm_t *inc)
 In-place add inc to tm.

int tm_cmp (const tm_t *a, const tm_t *b)
 Compare two times and return -1, 0 or +1 depending on their relative order.

void tm_now (tm_t *tm)
 Fill supplied structure with current time (cached).

void tm_now_exact (tm_t *tm)
 Fill supplied structure with current time (recomputed).

time_t tm_time (void)
 Get current time, at the second granularity (cached).

time_t tm_time_exact (void)
 Get current time, at the second granularity (recomputed).

gdouble tm_cputime (gdouble *user, gdouble *sys)
 Fill supplied variables with CPU usage time (user and kernel), if not NULL.

guint tm_hash (gconstpointer key)
 Hash a tm_t time structure.

gint tm_equal (gconstpointer a, gconstpointer b)
 Test two tm_t for equality.


Define Documentation

#define tm2f  )     ((double) (t)->tv_sec + (t)->tv_usec / 1000000.0)
 

tm2f

Convert timeval description into floating point representatiion.

#define tm2ms  )     ((t)->tv_sec * 1000 + (t)->tv_usec / 1000)
 

tm2ms

Convert timeval description into milliseconds.

#define tm_zero  )     ((t)->tv_sec == 0 && (t)->tv_usec == 0)
 

tm_zero

Returns true if time is zero.


Typedef Documentation

typedef GTimeVal tm_t
 


Function Documentation

void f2tm double  t,
tm_t tm
 

Convert floating point time description into a struct timeval by filling in the supplied structure.

void tm_add tm_t tm,
const tm_t inc
 

In-place add inc to tm.

int tm_cmp const tm_t a,
const tm_t b
 

Compare two times and return -1, 0 or +1 depending on their relative order.

gdouble tm_cputime gdouble *  user,
gdouble *  sys
 

Fill supplied variables with CPU usage time (user and kernel), if not NULL.

Returns:
total CPU time used so far (user + kernel).

void tm_elapsed tm_t elapsed,
const tm_t last,
const tm_t old
 

Computes the elapsed time (last - old) in the supplied structure.

gint tm_equal gconstpointer  a,
gconstpointer  b
 

Test two tm_t for equality.

guint tm_hash gconstpointer  key  ) 
 

Hash a tm_t time structure.

void tm_now tm_t tm  ) 
 

Fill supplied structure with current time (cached).

void tm_now_exact tm_t tm  ) 
 

Fill supplied structure with current time (recomputed).

void tm_sub tm_t tm,
const tm_t dec
 

In-place substract dec from tm.

time_t tm_time void   ) 
 

Get current time, at the second granularity (cached).

time_t tm_time_exact void   ) 
 

Get current time, at the second granularity (recomputed).


Generated on Sun Feb 12 10:50:08 2006 for Gtk-Gnutella by doxygen 1.3.6