These classes can shorten code and make the intent clearer. Several small helper classes that derive from a base time_duration, as shown below, to adjust for different resolutions. See Build-Compiler Information for more information. The resolution of the time_duration is configure able at compile time. The general time_duration class provides a constructor that takes a count of the number of hours, minutes, seconds, and fractional seconds count as shown in the code fragment below. A duration can be either positive or negative. The class boost::posix_time::time_duration the base type responsible for representing a length of time. The seconds held in the time_t are added to a time point of 1970-Jan-01.Ī template function that constructs a ptime from a FILETIME struct. The tm_isdst field is set to -1.Ĭreates a ptime from the time_t parameter. The fields: tm_year, tm_mon, tm_mday, tm_wday, tm_yday are set to zero. The fields: tm_wday, tm_yday, and tm_isdst are ignored.Ī function for converting a time_duration object to a tm struct. Ptime pt(date(2005,Jan,1), time_duration(1,2,3)) Ī function for converting a tm struct to a date object. Struct tm, time_t, and FILETIME Functionsįunctions for converting posix_time objects to, and from, tm structs are provided as well as conversion from time_t and FILETIME.Ī function for converting a ptime object to a tm struct. Time_duration t3 = t2 - t1 //negative result Return a ptime subtracting a time duration See Date Time IO System for more details (including exceptions and error conditions).Ī full complement of comparison operators Note: As of version 1.33, streaming operations have been greatly improved. Returns true if ptime is any special_value Returns true if ptime is positive infinity Returns true if ptime is negative infinity Returns true if ptime is either positive or negative infinity Ptime t(microsec_clock::universal_time()) If higher resolution is critical to your application test your platform to see the achieved resolution. Win32 systems often do not achieve microsecond resolution via this API. On most Win32 platforms it is implemented using ftime. On Unix systems this is implemented using GetTimeOfDay. Get the UTC time using a sub second resolution clock. Get the local time using a sub second resolution clock. Get the local time, second level resolution, based on the time zone settings of the computer.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |