title: gettimeofday for displaying current time without using space
body: <p>Is there any way to store number of time ticks from gettimeofday() and format into some specific way (for example "%m-%d-%Y  %T") without using any array?.</p>
  
  <p>This will save memory for each instance of a program which calculates current time.</p>
  
  <p>Code for the same using an array.(Taken from <a href="https://stackoverflow.com/questions/5362577/c-gettimeofday-for-computing-time">C - gettimeofday for computing time?</a>)</p>
  
  <pre><code>  char buffer[30];
    struct timeval tv;
  
    time_t curtime;
  
  
  
    gettimeofday(&amp;tv, NULL); 
    curtime=tv.tv_sec;
  
    strftime(buffer,30,"%m-%d-%Y  %T.",localtime(&amp;curtime));
   printf("%s%ld\n",buffer,tv.tv_usec);
  </code></pre>