TimeStamp - A replacement for COleDateTime and COleDateTimeSpan

This is another COleDateTime and COleDateTimeSpan replacement class.  However, it differs in two ways: it isn't dependent on MFC, and instead of using one class for date/time and another for date/time span, it unites the code into one class called TimeStamp.

Like Chris Sells' replacement, it was also started from the MFC version, and uses system calls for dates and times.  However, internally, the class uses a method called getAsDouble to determine whether an OLE DATE format is used or a double for the time span is used.  It incorporates all the functionality of COleDateTime and COleDataTimeSpan, but it uses a small character to start the method names.

An example of using the TimeStamp class is:


  // set start and end of time window
  TimeStamp start;
  start.getCurTimeStamp();
  TimeStamp end = start + TimeStamp::getdays (7);

There are static methods for returning a time interval, as in the above example, which can then be added to another time stamp to produce an end time.

Lastly, there are several string methods for getting the date time as a string.  These methods simplify usage so that you don't have to pull up help for GetTimeFormat/GetDateFormat to get the time as a string.

Download source - 5 KB    TimeStamp_src.zip



Comments

  • Bug in code...

    Posted by Legacy on 10/16/2003 12:00am

    Originally posted by: ron

    The setDateTime function used the minutes param as the month param....

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Live Event Date: August 20, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT When you look at natural user interfaces as a developer, it isn't just fun and games. There are some very serious, real-world usage models of how things can help make the world a better place – things like Intel® RealSense™ technology. Check out this upcoming eSeminar and join the panel of experts, both from inside and outside of Intel, as they discuss how natural user interfaces will likely be getting adopted in a wide variety …

  • Protecting business operations means shifting the priorities around availability from disaster recovery to business continuity. Enterprises are shifting their focus from recovery from a disaster to preventing the disaster in the first place. With this change in mindset, disaster recovery is no longer the first line of defense; the organizations with a smarter business continuity practice are less impacted when disasters strike. This SmartSelect will provide insight to help guide your enterprise toward better …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds