This library takes the current time (which must be set to UTC, e.g. via an NTP call), and applies a timezone definition (loaded at startup) to calculate the local time. This includes the handling of daylight saving. See http://mbed.org/users/hlipka/notebook/time-zone-handling/ for more information (esp. how to get a time zone definition file).

Dependents:   CubiScan 000-FIN_youcef 005_ESSAI_youcef

Embed: (wiki syntax)

« Back to documentation index

TimeStamp Class Reference

TimeStamp Class Reference

This class encapsulates a point in time - which means it will not change after it has been created. More...

#include <Time.h>

Public Member Functions

int getYear ()
int getMonth ()
int getDay ()
int getHour ()
int getMinute ()
int getSecond ()
int getDayOfWeek ()
 get the day of the week - monday is 0
 TimeStamp (time_t unixTime)
 creates a new time stamp based on the UNIX time stamp (seconds since 1970)
bool isSame (TimeStamp *ts)
bool isBefore (TimeStamp *ts)
char * asChar ()
bool isAfter (TimeStamp *ts)

Friends

class Time

Detailed Description

This class encapsulates a point in time - which means it will not change after it has been created.

Definition at line 37 of file Time.h.


Constructor & Destructor Documentation

TimeStamp ( time_t  unixTime )

creates a new time stamp based on the UNIX time stamp (seconds since 1970)

Returns:
the day-of-the-year of the time stamp

Definition at line 105 of file Time.h.


Member Function Documentation

char* asChar (  )
Returns:
time stamp transformed to ASCII (done by asctime() - but transformed to local time)

Definition at line 137 of file Time.h.

int getDay (  )

Returns:
the day-of-the-month of the time stamp (starting with 1)

Definition at line 54 of file Time.h.

int getDayOfWeek (  )

get the day of the week - monday is 0

Returns:
the day-of-the-week of the time stamp

Definition at line 86 of file Time.h.

int getHour (  )
Returns:
the hour of the time stamp (0-23)

Definition at line 64 of file Time.h.

int getMinute (  )
Returns:
the minute of the time stamp (0-59)

Definition at line 71 of file Time.h.

int getMonth (  )
Returns:
the month of the time stamp (January is 1)

Definition at line 50 of file Time.h.

int getSecond (  )
Returns:
the second of the time stamp (0-59)

Definition at line 78 of file Time.h.

int getYear (  )
Returns:
the year of the time stamp

Definition at line 43 of file Time.h.

bool isAfter ( TimeStamp ts )
Parameters:
tsthe time stamp to compare to
Returns:
true when the current time stamp is after the given time stamp

Definition at line 79 of file Time.cpp.

bool isBefore ( TimeStamp ts )
Parameters:
tsthe time stamp to compare to
Returns:
true when the current time stamp is before the given time stamp

Definition at line 54 of file Time.cpp.

bool isSame ( TimeStamp ts )
Parameters:
tsthe time stamp to compare to
Returns:
true when both timestamp are the same point in time

Definition at line 41 of file Time.cpp.