added TrapezoidProfile (copied from frc254-2011)
I cleaned it up extensively and added a couple of quick tests.
git-svn-id: https://robotics.mvla.net/svn/frc971/2013/trunk/src@4172 f308d9b7-e957-4cde-b6ac-9a88185e7312
diff --git a/aos/common/time.h b/aos/common/time.h
index c64f8b8..1d7ccae 100644
--- a/aos/common/time.h
+++ b/aos/common/time.h
@@ -121,6 +121,11 @@
(static_cast<int64_t>(nsec_) / static_cast<int64_t>(kNSecInMSec));
}
+ // Returns the time represented in fractional seconds.
+ double ToSeconds() const {
+ return static_cast<double>(sec_) + static_cast<double>(nsec_) / kNSecInSec;
+ }
+
#ifndef SWIG
Time &operator+=(const Time &rhs);
Time &operator-=(const Time &rhs);