why cant I acces private/protected members
| yor1001 (11) | |||
| I created a simple timer program but my method cant access the private members, anyone has any idea why. and the answer is like 3 billion. did i do anythin wrong with the difftieme() funciton.
| |||
| yor1001 (11) | |||
| Ok dont worry typo, I used the private varible instead of method, because they had almost the same name. | |||
| ropez (312) | |||
| Please post the solution in case someone else have a similar problem: Change line 47:
now->StartTime;to
now->StartTimer(); | |||
| yor1001 (11) | |||
| Oh yeah I did it, only one problem, Difftime never returns a fraction, it always return a whole number(integer, even though it is double). any ideas. | |||
| ropez (312) | |||
| According to the reference at this site, about time_t: "It is almost universally expected to be an integral value representing the number of seconds elapsed since [...]". This means that your timer can only get the number of seconds. | |||
| yor1001 (11) | |||
| Ok thanks, a bunch for your help, one last Q, is there any time value that is a float and not integer, I am gonna search the internet to see if now I guess I gotta use someone else codes (which I dont like because it just doesnt feel right). EDIT: I read up on the time() function return value and it states it returns what ever the argument is, only problem is the argument is time_t, is the way to make time_t a float, I gotta do more searching. | |||
| ropez (312) | |||
| I only know about platform-specific functions. On unix you have gettimeofday(), and I'm sure there is something similar on windows. | |||
| jsmith (379) | |||
| Also, clock_gettime() is a POSIX function that will (usually) return fine-grained time values, but I don't know of the POSIX compliance of Windows. | |||
| rpgfan3233 (111) | |||
| jsmith wrote: > Also, clock_gettime() is a POSIX function that will (usually) return > fine-grained time values, but I don't know of the POSIX compliance > of Windows. It isn't very POSIX-compliant at all... Many of the POSIX functions that are used commonly on UNIX and its various derivatives are completely unavailable in Windows. I have yet to figure out why Microsoft has never even attempted to be POSIX-compliant. | |||
This topic is archived - New replies not allowed.
