time accuracy

I have this program to chk time, but the accuracy is 2 sec.
I want to chk less than 1 sec
pls help , thanks


int main(void)
FILE *stream;
std::ftime ft;
int h,m,s,ms;
if ((stream = fopen("TEST.$$$","wt")) == NULL)
{ fprintf(stderr, "Cannot open output file.
"); return 1; }
getftime(fileno(stream), &ft);
h=ft.ft_hour; m=ft.ft_min; s=ft.ft_tsec;
printf("File time: %u:%u:%u
printf("File date: %u/%u/%u
ft.ft_month, ft.ft_day,ft.ft_year+1980);
cout << "

Press any key to continue";
getch(); // wait for key pressure
return 0;


  • What does this C program have to do with C++ Builder? I guess nothing, so please post it on the C/C++ Board!

    See ya there,

  • dears
    I have c++ builder 6 from Borland
    I took this program from help examples
    I want to add it to my big program but I need more accuracy to measure time (by less than 2 sec).
    do you have any suggestion
    thanks a lot
  • Sure, your programming environment might be C++ Builder, but all the functions you use are plain C++. You can recognize C++ Builder code from stuff like 'TForm', 'TButton', ,#include , the abscence of '#include , etc..

    In plain C++ you can check http://www.codepedia.com/1/CppTimeH
    In C++ Builder, you might want to stick to the TTimer component.

    See ya,

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!