Tuesday, July 28, 2009

How to update time & date in C++?

I am new to C++. I used the following function get the time:


time_t currentTime;


time(%26amp; currentTime);


cout %26lt;%26lt; asctime(localtime(%26amp; currentTime));





But the time does not change unless I refresh the page%26gt; Could someone show how to update the time on the screen?

How to update time %26amp; date in C++?
#include %26lt;iccclkeh.hpp%26gt;





class


{


IccClock(UpdateMode update = manual);


IccAbsTime%26amp; ansTime();


void cancelAlarm(const IccRequestId* reqId= 0);


const char* date (DateFormat format= defaultFormat;


char dateSeparator='\0');


unsigned long dayOfMonth();


DayOfWeek dayOfWeek();


unsigned long daysSince1900();


long double milliSeconds();


MonthOfYear monthOfYear();


const IccAlarmRequestId%26amp; setAlarm (const IccTime%26amp; time,


const IccRequestId* reqId= 0);


const char* time(char timeSeparator= '\0');


void update();


unsigned long year();


typedef enum{


defaultFormat,


DDMMYY,


MMDDYY,


YYDDD,


YYDDMM,


YYMMDD,


DDMMYYYY,


MMDDYYYY,


YYYYDDD,


YYYYDDMM,


YYYYMMDD,


} DateFormat;


typedef enum {


Sunday,


Monday,


Tuesday,


Wednesday,


Thursday,


Friday,


Saturday,


} DayOfWeek;


typedef enum {


January,


February,


March,


April,


May,


June,


July,


August,


September,


October,


November,


December,


} MonthOfYear;


typedef enum {


manual,


automatic,


} UpdateMode;


};
Reply:click on your time down at the bottm


No comments:

Post a Comment