Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7681229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T18:17:40+00:00 2026-05-31T18:17:40+00:00

Can some one tell me how do i display real time in c++. what

  • 0

Can some one tell me how do i display real time in c++. what i mean is that while the program is running you can see the seconds and or minutes counting down like a real clock hanging on the wall

this is what I have:

int main ()
{
  time_t rawtime; //creates and object of the built in time function
  struct tm * timeinfo; //no idea what this do

  time ( &rawtime ); //gets the time from the computer
  timeinfo = localtime ( &rawtime ); //store that time here

  //it displays current date and time except time is frozen and not real time
  cout<< "Current local time and date: "<<asctime (timeinfo)<< endl; 


  system("pause");
  return 0;

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T18:17:41+00:00Added an answer on May 31, 2026 at 6:17 pm

    Not in C++ (in C/Win32) but works.

    #include <stdio.h>
    #include <windows.h>
    
    
    int _tmain(int argc, _TCHAR* argv[])
    {
        SYSTEMTIME stime;   //structure to store system time (in usual time format)
        FILETIME ltime;     //structure to store local time (local time in 64 bits)
        FILETIME ftTimeStamp;
        char TimeStamp[256];//to store TimeStamp information
        while (true){
        ////Prepare data needed to output the time stamp:
        GetSystemTimeAsFileTime(&ftTimeStamp); // Gets the current system time
        FileTimeToLocalFileTime (&ftTimeStamp,&ltime);//convert in local time and store in ltime
        FileTimeToSystemTime(&ltime,&stime);//convert in system time and store in stime
    
        sprintf(TimeStamp, "%d:%d:%d, %d.%d.%d \r",stime.wHour,stime.wMinute,stime.wSecond, stime.wDay,stime.wMonth,stime.wYear);
        printf(TimeStamp);
    
        Sleep(1000);
        }
    
        system("pause");
        return 0;
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can some one please explain why when I tell a div that: it's height
Please can some one briefly tell me with example what does the means of
can any one please tell me how to make the some items in multichoice
Can any one tell me how to retrieve image from RSS feed and display
Can someone tell me how i can change the .xml file that a flash
I have one UIImageView that I use to display different images at different points
I have a div box with some images that the user can click. When
My web app may display messages from time to time. Some of the messages
As near as I can tell, this falls under a you can't do that.
I am have some bitmaps which i want to display serially one after another

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.