Support Forums > WinFBX - Windows Framework for FreeBASIC

CPowerTime Class

(1/2) > >>

Josť Roca:
A new class, CPowerTime, to easily work with date and time calculations.

Documentation:
https://github.com/JoseRoca/WinFBX/blob/master/docs/DateTime/CPowerTime%20Class.md

Wilko Verweij:
Thanks! Wilko

Paul Squires:
Awesome! Thanks so much.

Paul Squires:
I'm browsing through the class and thinking thoughts like, what if I have have a starting powertime and and ending powertime class how would I determine the difference between the two class instances. For example, let's say we want to profile a section of code or an algorithm. Maybe retrieve both using the GetFileTime property and do the difference calculation?

Josť Roca:
Yes. You can do:


--- Code: ---DIM cpt AS CPowerTime
DIM cpt2 AS CPowerTime
cpt.Now
print "Press a key"
sleep
cpt2.Now
DIM nTime AS ULONGLONG = cpt2 - cpt
print nTime / CPowerTime_Millisecond
print nTime / CPowerTime_Second
print nTime

--- End code ---

BTW there are two methods in the PowerBasic PowerTime object that I already haven't implemented: DateDiff and TimeDiff. Not sure how to code them.

Navigation

[0] Message Index

[#] Next page

Go to full version