How to use current system time in local variables

0 votes
asked Jan 2, 2019 by sreer (120 points)
In my project i want to use current system time for every loop

plz give me example program to use system time in variables

1 Answer

0 votes
answered Jan 2, 2019 by anonymous
#include <stdio.h>
#include <time.h>

int main ()
{
  time_t rawtime;
  struct tm * timeinfo;

  time ( &rawtime );
  timeinfo = localtime ( &rawtime );
  printf ( "Current local time and date: %s", asctime (timeinfo) );

  return 0;
}
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...