Archived

This topic is now archived and is closed to further replies.

spree

Time in VC

Recommended Posts

I need to get the h,m,s and mili seconds in a windows 32 console application. In turbo c under DOS inviorment I used the gettime(&t); function to retrive the current time, when t is a time structure. But the gettime function was in the dos.h, and i cant use it under my application. So how do i get the time?

Share this post


Link to post
Share on other sites

/* time example */
#include <stdio.h>
#include <time.h>

int main ()
{
time_t seconds;

seconds = time (NULL);
printf ("%ld hours since January 1, 1970", seconds/3600);

return 0;
}

Share this post


Link to post
Share on other sites