Boost logo

Boost Users :

From: Larry (lknain_at_[hidden])
Date: 2007-12-24 07:21:13


Perhaps something like where p1 and p2 are as you defined them

time_duration onehour(1,0,0);

if (p2 > (p1 + onehour)) {
      return false;
}

Larry
----- Original Message -----
From: "tonyaim83" <abhishek.v_at_[hidden]>
Newsgroups: gmane.comp.lib.boost.user
To: <boost-users_at_[hidden]>
Sent: Monday, December 24, 2007 6:29 AM
Subject: Help needed on time date

>
> Hi
> I'm using Date time library for the first time so no idea how best make
> use
> of it.
> My primary target is to check if the first timestamp and second timestamp
> entered by the user are in a span of one hour.
> Format of input string is as follows YYYYDDMM-HH:MM:SS(20071015-17:47:10)
> Now if the second string is also in the an hour span it should return true
> otherwise false.
> I m thinking of doing this like
> std::string to_iso_string(date d1)
> ptime p1(d1, time_duration("17:21:23"));
> std::string to_iso_string(date d2)
> ptime p2(d2, time_duration("17:22:23"));
>
> ptime p3=p2-p1;
> if (p3>1)
> {
> return false;
> }
> I could also find a function which has a separator T
> std::string to_iso_extended_string(ptime);
> How can i make use of this function as in my case the separtor of date-
> time
> is "-" Or a better way to perform the same task.
>
> --
> View this message in context:
> http://www.nabble.com/Help-needed-on-time-date-tp14486644p14486644.html
> Sent from the Boost - Users mailing list archive at Nabble.com.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net