Boost logo

Boost :

From: Jeff Garland (jeff_at_[hidden])
Date: 2003-07-10 08:44:16


On Wed, 09 Jul 2003 09:33:44 -0400, Stefan Seefeld wrote
> hi there,
>
> what is the suggested way to persist a time_duration into a string ?
> I tried 'to_iso_string' but there is no corresponding
> 'duration_from_iso_string'. Shouldn't that exist (if only for
> symmetry) ?

Yes it should be there for symmetry. Give this a shot:
  using boost::posix_time;
  std::string tds; //.. your duration string
  time_duration td =
boost::date_time::parse_undelimited_time_duration<time_duration>(tds);

This doesn't look like it will handle fractional seconds, but maybe you don't
need that...

Jeff


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk