JWM Source Documentation
Data Structures | Macros | Typedefs | Functions
timing.h File Reference

Timing functions. More...

Go to the source code of this file.

Data Structures

struct  TimeType
 Structure to represent time since January 1, 1970 GMT. More...
 

Macros

#define ZERO_TIME   { 0, 0 }
 Initializer for TimeType to indicate that it is not set.
 

Typedefs

typedef struct TimeType TimeType
 Structure to represent time since January 1, 1970 GMT.
 

Functions

void GetCurrentTime (TimeType *t)
 Get the current time.
 
unsigned long GetTimeDifference (const TimeType *t1, const TimeType *t2)
 Get the difference between two times.
 
const char * GetTimeString (const char *format, const char *zone)
 Get a time string.
 

Detailed Description

Timing functions.

Author
Joe Wingbermuehle
Date
2004-2006

Definition in file timing.h.

Macro Definition Documentation

#define ZERO_TIME   { 0, 0 }

Initializer for TimeType to indicate that it is not set.

Definition at line 14 of file timing.h.

Referenced by Signal().

Typedef Documentation

typedef struct TimeType TimeType

Structure to represent time since January 1, 1970 GMT.

Function Documentation

void GetCurrentTime ( TimeType t)

Get the current time.

Parameters
tThe TimeType to fill.

Definition at line 16 of file timing.c.

References TimeType::ms, and TimeType::seconds.

Referenced by EventLoop(), MoveClient(), ProcessClockMotionEvent(), ProcessMotionEvent(), ProcessPagerMotionEvent(), ProcessTaskMotionEvent(), Resize(), and Signal().

unsigned long GetTimeDifference ( const TimeType t1,
const TimeType t2 
)

Get the difference between two times.

Note that the times must be normalized.

Parameters
t1The first time.
t2The second time.
Returns
The difference in milliseconds (maximum of 60000 ms).

Get the difference between two times.

If the difference is larger than a MAX_TIME_SECONDS, then MAX_TIME_SECONDS will be returned. Note that the times must be normalized.

Definition at line 29 of file timing.c.

References JUNLIKELY, MAX_TIME_SECONDS, TimeType::ms, and TimeType::seconds.

Referenced by EventLoop(), MenuCallback(), Signal(), SignalClock(), SignalPager(), SignalTaskbar(), SignalTrayButton(), and UpdateDesktop().

const char* GetTimeString ( const char *  format,
const char *  zone 
)

Get a time string.

Note that the string returned is a static value and should not be deleted. Therefore, this function is not thread safe.

Parameters
formatThe format to use for the string.
zoneThe timezone in tzset() format to use (defaults to local)
Returns
The time string.

Definition at line 57 of file timing.c.

Referenced by DrawClock(), and SignalClock().

joewing.net / Projects / JWM