Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
New Visual FreePro time/timing functions
Message
De
05/10/2013 16:35:34
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
New Visual FreePro time/timing functions
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01584822
Message ID:
01584822
Vues:
90
Visual FreePro adds two new variable types, and several new functions:

(1) DATESECONDS(), a DATE() plus SECONDS() combination, useful for storing DATETIME() down to millisecond values
(2) DATESECONDSX(), a DATE() plus SECONDSX() combination, useful for storing DATETIME() down to about a 0.00002 second resolution (50x greater than SECONDS()).

(3) DATETIMEX(), explained below.

DATESECONDS() and DATESECONDSX() can be converted to standard DATETIME(), and vice-versa, with supporting new functions:
(4) DSTOC() DateSeconds to character in the form YYMMDD sssss.mmm
(5) CTODS() Character to dateseconds
(6) DSXTOC() DateSecondsX to character in the form YYYYMMDD sssss.mmmmm
(7) CTODSX() Character to dateseconds
(8) DSTODSX() Dateseconds to Datesecondsx
(9) DSXTODS() Datesecondsx to Dateseconds
(10) DTXTOC() Datetimex to character
(11) CTODTX() Character to Datetimex
(12) DSTOT() DateSeconds to Datetime
(13) DSXTOT() DateSecondsX to Datetime
(14) DTXTOT() DatetimeX to Datetime
(15) And the corresponding Datetime conversion functions, TTODS(), TTODSX(), TTODTX().

DATESECONDS(), DATESECONDSX() can be subtracted, added to, to create new values just like DATETIME(). And DATETIMEX() can be subtracted, added to, using the DATETIMEXMATH() function.

These were all added to allow familiar and easy-to-use higher resolution timing abilities in Visual FreePro.

-----
DATETIMEX()
This is a unique animal. It is a standard 8-byte integer, but one which stores the number of clock ticks since a given time (typically since the machine startup). These ticks are at CPU clock cycle resolution and, therefore, vary per machine (one machine at 2 GHz will have 2 billion ticks per second, another machine at 3.3 GHz will have 3.3 billion ticks per second). DATETIMEX() values can be stored in tables natively in an 8-byte form, and will record the reference DATETIME() value to which they relate.

DATETIMEX values are not stand-alone with regards to a date. They require a reference DATETIME() value to all computation into an explicit time (a Visual FreePro system variable is available for this, which is _DATETIME_STARTUP). However, as they exist in raw numeric form, they are highly accurate and can be used to coordinate data without any possibility of overlap as every DATETIMEX() value is guaranteed to be unique on any given operation, even on an operation like REPLACE ALL nValue WITH DATETIMEX(), as the function is queried at each use (and since it relates to machine clock cycles, it will actually always be at least 30 or ticks away between even the highest speed operations).

-----
SECONDSX()
This is a SECONDS()-like function, but one which stores a 4-byte integer from 0..((2^32)-1), which yields a resolution down to 0.000020117 ticks per second, roughly 50x greater than SECONDS() allows today in the same memory footprint.

-----
DATESECONDSX()
This format can be stored in tables natively in an 8-byte form, allowing for unique timestamps with up to nearly 50,000 records per second being added. A new table setting also allows every DATESECONDSX() field to be guaranteed unique, with the sacrifice of exactness should more than 50,000 records per second be added.

-----
Please post any questions. Thank you.

Read more at:
http://www.visual-freepro.org/wiki/index.php/VXB%2B%2B
http://www.visual-freepro.org/wiki/index.php/Variable_Types
http://www.visual-freepro.org/wiki/index.php/VFrP_changes

Track ongoing changes at:
http://www.visual-freepro.org/wiki/index.php/Special:RecentChanges
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform