/** @return A string of the form h:m:s:e padded as in 00:00:00:000 */
string
-Time::to_string () const
+Time::as_string () const
{
stringstream str;
str << setw(2) << setfill('0') << h << ":"
}
int64_t
-Time::to_editable_units (int tcr_) const
+Time::as_editable_units (int tcr_) const
{
return (int64_t(e) * float (tcr_ / tcr)) + int64_t(s) * tcr_ + int64_t(m) * 60 * tcr_ + int64_t(h) * 60 * 60 * tcr_;
}
double
-Time::to_seconds () const
+Time::as_seconds () const
{
return h * 3600 + m * 60 + s + double(e) / tcr;
}
int e; ///< editable units (where 1 editable unit is 1 / tcr_ seconds)
int tcr; ///< timecode rate: the number of editable units per second.
- std::string to_string () const;
- double to_seconds () const;
- int64_t to_editable_units (int tcr_) const;
+ std::string as_string () const;
+ double as_seconds () const;
+ int64_t as_editable_units (int tcr_) const;
Time rebase (int tcr_) const;
private:
subtitle_element = font_element->add_child ("Subtitle");
subtitle_element->set_attribute ("SpotNumber", raw_convert<string> (spot_number++));
- subtitle_element->set_attribute ("TimeIn", i->in().to_string());
- subtitle_element->set_attribute ("TimeOut", i->out().to_string());
- subtitle_element->set_attribute ("FadeUpTime", raw_convert<string> (i->fade_up_time().to_editable_units(250)));
- subtitle_element->set_attribute ("FadeDownTime", raw_convert<string> (i->fade_down_time().to_editable_units(250)));
+ subtitle_element->set_attribute ("TimeIn", i->in().as_string());
+ subtitle_element->set_attribute ("TimeOut", i->out().as_string());
+ subtitle_element->set_attribute ("FadeUpTime", raw_convert<string> (i->fade_up_time().as_editable_units(250)));
+ subtitle_element->set_attribute ("FadeDownTime", raw_convert<string> (i->fade_down_time().as_editable_units(250)));
last_in = i->in ();
last_out = i->out ();
BOOST_CHECK_EQUAL (t.s, 34);
BOOST_CHECK_EQUAL (t.m, 18);
BOOST_CHECK_EQUAL (t.h, 11);
- BOOST_CHECK_EQUAL (t.to_string(), "11:18:34:073");
+ BOOST_CHECK_EQUAL (t.as_string(), "11:18:34:073");
/* Use a tcr of 24 so that the editable event is a frame */
dcp::Time a (3, 2, 3, 4, 24);
BOOST_CHECK_EQUAL (r.m, 58);
BOOST_CHECK_EQUAL (r.s, 58);
BOOST_CHECK_EQUAL (r.e, 23);
- BOOST_CHECK_EQUAL (r.to_string(), "00:58:58:023");
+ BOOST_CHECK_EQUAL (r.as_string(), "00:58:58:023");
/* Different tcr (25) */
a = dcp::Time (1, 58, 56, 2, 25);
BOOST_CHECK_EQUAL (r.m, 6);
BOOST_CHECK_EQUAL (r.s, 8);
BOOST_CHECK_EQUAL (r.e, 3);
- BOOST_CHECK_EQUAL (r.to_string(), "03:06:08:003");
+ BOOST_CHECK_EQUAL (r.as_string(), "03:06:08:003");
/* Another arbitrary tcr (30) */
a = dcp::Time (24, 12, 6, 3, 30);