Calculate time with int
-
Hi all sorry for asking, but how do i calculate time"hh:mm:ss" / int(pages) *100. for example 00:00:10 / 10 *100 Gonna count the time of 100 pages... big reggards!! Thanks
andredani wrote:
Hi all sorry for asking, but how do i calculate time"hh:mm:ss" / int(pages) *100. for example 00:00:10 / 10 *100 Gonna count the time of 100 pages...
Have you taken a look at the DateTime and TimeSpan classes? I suspect that would provide you with the answer. Good Luck!
It isn't enough to do well in life. One must do good when and where one can. Otherwise, what's the point?
-
andredani wrote:
Hi all sorry for asking, but how do i calculate time"hh:mm:ss" / int(pages) *100. for example 00:00:10 / 10 *100 Gonna count the time of 100 pages...
Have you taken a look at the DateTime and TimeSpan classes? I suspect that would provide you with the answer. Good Luck!
It isn't enough to do well in life. One must do good when and where one can. Otherwise, what's the point?
I'd go with what Matthew said. But why are you multiplying the pages by 100? Using pseudo-code, you've written:
TimeSpent / NrOfPages * 100
Best regards! -Larantz-for those about to code, we salute you
http://www.itverket.noPlease refer to the Forum Guidelines for appropriate posting.
-
Hi all sorry for asking, but how do i calculate time"hh:mm:ss" / int(pages) *100. for example 00:00:10 / 10 *100 Gonna count the time of 100 pages... big reggards!! Thanks
The TimeSpan structure has a Ticks property that gives you the time as a long value, and a constructor that takes a long value. Example:
TimeSpan duration = new TimeSpan(0, 0, 10);
int ticks = (int)duration.Ticks;
int pages = 10;
int calculatedTicks = ticks * 100 / pages;
TimeSpan calculatedTime = new TimeSpan((long)calculatedTicks);--- single minded; short sighted; long gone;