src/simulator/nstime.h
changeset 111 ad64f88919b5
parent 110 9ac6d63bfe33
child 122 6b8f1eda5c57
equal deleted inserted replaced
110:9ac6d63bfe33 111:ad64f88919b5
    33  */
    33  */
    34 class Time {
    34 class Time {
    35 public:
    35 public:
    36     Time (Time const &o);
    36     Time (Time const &o);
    37     Time &operator = (Time const &o);
    37     Time &operator = (Time const &o);
    38 	/**
    38     /**
    39 	 * \returns the time stored in this
    39      * \returns the time stored in this
    40 	 *          instance as seconds.
    40      *          instance as seconds.
    41 	 */
    41      */
    42     double s (void) const;
    42     double s (void) const;
    43 	/**
    43     /**
    44 	 * \returns the time stored in this
    44      * \returns the time stored in this
    45 	 *          instance as microseconds.
    45      *          instance as microseconds.
    46 	 */
    46      */
    47     uint64_t us (void) const;
    47     uint64_t us (void) const;
    48 	/**
    48     /**
    49 	 * \returns the time stored in this
    49      * \returns the time stored in this
    50 	 *          instance as nanoseconds.
    50      *          instance as nanoseconds.
    51 	 */
    51      */
    52     uint64_t ns (void) const;
    52     uint64_t ns (void) const;
    53 	/**
    53     /**
    54 	 * \returns true if this instance represents
    54      * \returns true if this instance represents
    55 	 *          the "destroy" time.
    55      *          the "destroy" time.
    56 	 */
    56      */
    57     bool isDestroy (void) const;
    57     bool isDestroy (void) const;
    58 	/**
    58     /**
    59 	 * \param s absolute time in seconds
    59      * \param s absolute time in seconds
    60 	 * \returns a constructed Time object
    60      * \returns a constructed Time object
    61 	 */
    61      */
    62     static Time absS (double s);
    62     static Time absS (double s);
    63 	/**
    63     /**
    64 	 * \param us absolute time in microseconds
    64      * \param us absolute time in microseconds
    65 	 * \returns a constructed Time object
    65      * \returns a constructed Time object
    66 	 */
    66      */
    67     static Time absUs (uint64_t us);
    67     static Time absUs (uint64_t us);
    68 	/**
    68     /**
    69 	 * \param ns absolute time in nanoseconds
    69      * \param ns absolute time in nanoseconds
    70 	 * \returns a constructed Time object
    70      * \returns a constructed Time object
    71 	 */
    71      */
    72     static Time absNs (uint64_t ns);
    72     static Time absNs (uint64_t ns);
    73 	/**
    73     /**
    74 	 * \param s relative time in seconds
    74      * \param s relative time in seconds
    75 	 * \returns a constructed Time object
    75      * \returns a constructed Time object
    76 	 */
    76      */
    77     static Time relS (double s);
    77     static Time relS (double s);
    78 	/**
    78     /**
    79 	 * \param us relative time in microseconds
    79      * \param us relative time in microseconds
    80 	 * \returns a constructed Time object
    80      * \returns a constructed Time object
    81 	 */
    81      */
    82     static Time relUs (uint64_t us);
    82     static Time relUs (uint64_t us);
    83 	/**
    83     /**
    84 	 * \param ns relative time in nanoseconds
    84      * \param ns relative time in nanoseconds
    85 	 * \returns a constructed Time object
    85      * \returns a constructed Time object
    86 	 */
    86      */
    87     static Time relNs (uint64_t ns);
    87     static Time relNs (uint64_t ns);
    88 	/**
    88     /**
    89 	 * \returns a constructed Time object which represents
    89      * \returns a constructed Time object which represents
    90 	 *          the current simulation time
    90      *          the current simulation time
    91 	 */
    91      */
    92     static Time now (void);
    92     static Time now (void);
    93 	/**
    93     /**
    94 	 * \returns a constructed Time object which represents
    94      * \returns a constructed Time object which represents
    95 	 *          the current "destroy" simulation time, that
    95      *          the current "destroy" simulation time, that
    96 	 *          is, the time when Simulator::destroy is
    96      *          is, the time when Simulator::destroy is
    97 	 *          invoked by the user.
    97      *          invoked by the user.
    98 	 */
    98      */
    99     static Time destroy (void);
    99     static Time destroy (void);
   100 private:
   100 private:
   101     Time (uint64_t ns);
   101     Time (uint64_t ns);
   102     Time ();
   102     Time ();
   103     uint64_t m_ns;
   103     uint64_t m_ns;