Re: Display System Time running real time

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Thanks. Issue resolved.

On Dec 5, 10:09 am, Joseph M. Newcomer <newco...@xxxxxxxxxxxx> wrote:
CTime t;
t.GetCurrentTime();
CString s = t.Format(_T("%H:%M:%S etc..."));
CString old;
c_TimeDisplay.GetWindowText(old);
if(old != s)
   c_TimeDisplay.SetWindowText(s);

put this in an OnTimer handler with a 1sec timer interval.

Note that this is not locale-sensitive.  To create code that handles locale-sensitive
display, take a look at my Locale Explorer.  If you don't care, you can figure out the
display options by using my CTime Explorer.  These can all be downloaded from my MVP Tips
site.
                                joe



On Thu, 4 Dec 2008 16:58:24 -0800 (PST), "aloha...@xxxxxxxxx" <aloha...@xxxxxxxxx> wrote:
Hi

how to display the system date time running real time in Dialog,
including seconds ?

I know declaring like:
    SYSTEMTIME systime;
    ZeroMemory(&systime,sizeof(SYSTEMTIME));
    GetSystemTime(&systime);       // gets current time

        then access the SYSTEMTIME structure:

typedef struct _SYSTEMTIME {
  WORD wYear;
  WORD wMonth;
  WORD wDayOfWeek;
  WORD wDay;
  WORD wHour;
  WORD wMinute;
  WORD wSecond;
  WORD wMilliseconds;
} SYSTEMTIME;

but how to get it running in realtime as it elapses seconds by seconds
like

    8:56:01 AM     Monday, December 02, 2008
 ...then
    8:56:02 AM     Monday, December 02, 2008
 ...then
    8:56:03 AM     Monday, December 02, 2008

Regards.

Joseph M. Newcomer [MVP]
email: newco...@xxxxxxxxxxxx
Web:http://www.flounder.com
MVP Tips:http://www.flounder.com/mvp_tips.htm

.



Relevant Pages