Page 1 of 1

how to get millisecond and print it out?

Posted: Sat Jul 09, 2011 2:12 am
by rob
hi,
i am a newby, i am new to c++. i have a very basic question. how do i sandwich a function to see how many millisecond it take to runs?
thanks

Re: how to get millisecond and print it out?

Posted: Sat Jul 09, 2011 7:33 am
by doublemax

Re: how to get millisecond and print it out?

Posted: Sat Jul 09, 2011 3:51 pm
by rob
thanks doublemax. it will probably takes me couple of days to digest it. i really appreciate it.

Re: how to get millisecond and print it out?

Posted: Sat Jul 09, 2011 6:20 pm
by rob
hi doublemax:

i looked at the stopwatch.h and found that Time() is declared but not defined. is that the header file of mine is inadequate? when i called the Time(), the compiler gave me an undefined error. i thought that the include statement in my program <wx/stopwatch.h> is incorrect but it did not generate any error.
please help.
thanks.

Re: how to get millisecond and print it out?

Posted: Sat Jul 09, 2011 6:48 pm
by doublemax
Do you get a compiler or linker error?

Also, which platform/IDE/compiler are you using?

If you're totally new to c++ and wxWidgets, you should start by getting the wxWidgets "minimal" sample to compile. That makes sure you have all the include directories and libraries correct.

Re: how to get millisecond and print it out?

Posted: Sat Jul 09, 2011 11:33 pm
by rob
hi,
i got linker errors and i used wxDevc++. i don't know what you mean by minimal sample?
thanks for reply.

Re: how to get millisecond and print it out?

Posted: Sun Jul 10, 2011 12:23 am
by rob
hi,
i did not use wxwidget, i wrote a program basically a procedural oriented C type program. it run just fine. i used time.h's time() to measure a function. but it only returned time in seconds. when it run, i usually got o second. that is why i want to benchmark it with milliseconds.
thanks.

Re: how to get millisecond and print it out?

Posted: Sun Jul 10, 2011 10:04 am
by doublemax
AFAIK there is no easy standard way to get millisecond accuracy.

Maybe this helps:
http://stackoverflow.com/questions/3613 ... ing-ansi-c

Re: how to get millisecond and print it out?

Posted: Sun Jul 10, 2011 6:08 pm
by rob
thank you very much. it helps a lot.
bye.

Re: how to get millisecond and print it out?

Posted: Wed Feb 26, 2014 6:25 pm
by Sarah Keys
I was just looking for this and I've found this thread.
www.ipillows.net
When I click the link it says Documentation Not Found :( 21 day fix video
Thanks Best Phone Grip
Days to Fitness Ted Reviews
Sarah Tycoon Addon

Re: how to get millisecond and print it out?

Posted: Wed Feb 26, 2014 6:44 pm
by PB
You were just one click away from the page, all you needed was to select the version. Anyway, here it goes

current version: http://docs.wxwidgets.org/trunk/classwx_stop_watch.html
old version 2.8.12: http://docs.wxwidgets.org/2.8.12/wx_wxstopwatch.html

Re: how to get millisecond and print it out?

Posted: Fri Mar 07, 2014 2:16 pm
by Sarah Keys
Ah you are right :oops: . Thanks for the help :)

Sarah