<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 12/10/2014 06:05 PM, Peter Witkowski
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAN1Qg3OnSjhAaiJw6Tb8p3e-s6LkMW_t1FRsuh7DtvJrSEhxXg@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div>Hi Marcus,<br>
            <br>
            Thanks for this.<br>
            <br>
            To reiterate (and correct me if I'm wrong), in the general
            case, system time on the USRP is totally arbitrary.  With a
            GPSDO attached, the system time synchronizes to UTC via NMEA
            messaging from the GPSDO and counts seconds after Unix epoch
            (basically it's just Unix system time at this point).<br>
            <br>
          </div>
          I'm assuming that any time_spec_t value passed to/from the
          USRP must as a result follow this reference.  Sure there are
          applications that can use an arbitrary clock, but for the
          GPSDO case, the time_spec_t values I pass to/from the USRP
          should be Unix system time.<br>
          <br>
          Note that my understanding of GPS (and I could be wrong here)
          is that the satellite broadcasts include the information
          necessary to convert from GPS time to UTC time.  Therefore,
          the GPSDO should be able to stay true to UTC in it's internal
          conversions from GPS time to UTC time.<br>
          <br>
        </div>
        As a result, it might be a little misleading calling the sensor
        name "gps_time" since it's using UTC as a reference and not
        actual GPS time.<br>
      </div>
    </blockquote>
    Perhaps "gps_time_referenced_to_UTC_and_made_Unixy" would be a
    better sensor name, but somewhat long.<br>
    <br>
    It was felt that having the TOD clock on the USRP, when you have a
    GPSDO produce time, that is consistent with what a time_t on the
    host<br>
      (from, perhaps, a time(&time_t)) would contain was important
    for a lot of applications.   But it was also felt that the TOD clock
    hardware shouldn't<br>
      actually "know" anything about calendar time.  That allows
    applications that have no notion (nor care about) calendar time, but
    just want all boxes<br>
      to have a common notion of time when they start streaming--there
    are many such applications.<br>
    <br>
    In fact, applications where the ability to reference some specific
    sample timestamp, to a time as seen by some unrelated observer who
    uses conventional<br>
      calendar time, are probably a smaller population than those who
    simply require that all the USRPs "agree among themselves".<br>
    <br>
    <br>
    <br>
    <br>
    <blockquote
cite="mid:CAN1Qg3OnSjhAaiJw6Tb8p3e-s6LkMW_t1FRsuh7DtvJrSEhxXg@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div class="gmail_extra"><br>
            <div class="gmail_quote">On Wed, Dec 10, 2014 at 5:43 PM,
              Marcus D. Leech <span dir="ltr"><<a
                  moz-do-not-send="true" href="mailto:mleech@ripnet.com"
                  target="_blank">mleech@ripnet.com</a>></span>
              wrote:<br>
              <blockquote class="gmail_quote" style="margin:0 0 0
                .8ex;border-left:1px #ccc solid;padding-left:1ex">
                <div bgcolor="#FFFFFF" text="#000000"><span class="">
                    <div>On 12/10/2014 05:24 PM, Ian Buckley wrote:<br>
                    </div>
                    <blockquote type="cite"> time_spec_t is nothing more
                      than a container for a highly accurate count of
                      seconds and fractions there of. It measures from
                      no reference …that entirely down to you to decide
                      what seconds is relative to.
                      <div>The USRP doesn't care about calendars, if you
                        set time from a UTC coordinated source and then
                        an event like a leap second occurs then the USRP
                        will no longer be coordinated with UTC.</div>
                    </blockquote>
                  </span> Also, in addition:<br>
                  <br>
                  <a moz-do-not-send="true"
                    href="http://files.ettus.com/manual/page_gpsdo.html"
                    target="_blank">http://files.ettus.com/manual/page_gpsdo.html</a><br>
                  <br>
                  The "gps_time" sensor will return a format suitable
                  for use as a Unix epoch time, and that is what the TOD
                  registers in the USRP will be initialized to<br>
                    automatically when you have a built-in GPSDO.<br>
                  <br>
                  But, like Ian says, the TOD registers and logic in the
                  USRP know nothing of Gregorian calendars, etc.   A
                  time_spec_t of '0' is interpreted however<br>
                    you want to interpret it, although the Unix
                  epoch-time is certainly convenient, and that's what it
                  gets set to when you have a GPSDO, and what<br>
                    the "gps_time" sensor returns, and what the
                  uhd::time_spec_t::get_system_time() method will return
                  on POSIX systems, the hardware really<br>
                    doesn't care.  It just takes whatever is stuffed in
                  there initially, and just keeps incrementing  it at an
                  appropriate rate.  If you call the get_time_now()<br>
                    uhd::multi_usrp method it will return a time_spec_t,
                  upon which you can call get_ful_secs(), which will be
                  a time_t.  If the USRP has been initialized<br>
                    with a Unix-epoch type time, then that time_t should
                  correpond to Unix-epoch time.
                  <div>
                    <div class="h5"><br>
                      <br>
                      <br>
                      <br>
                      <br>
                      <blockquote type="cite">
                        <div><br>
                          <div>
                            <div>On Dec 10, 2014, at 1:37 PM, Peter
                              Witkowski via USRP-users <<a
                                moz-do-not-send="true"
                                href="mailto:usrp-users@lists.ettus.com"
                                target="_blank">usrp-users@lists.ettus.com</a>>

                              wrote:</div>
                            <br>
                            <blockquote type="cite">
                              <div dir="ltr">
                                <div>
                                  <div>Hi Marcus,<br>
                                    <br>
                                  </div>
                                  I've looked at the documentation
                                  (prior to sending my original mailing
                                  list message) and am still lost.  Let
                                  me rephrase my question.  Since
                                  time_spec_t just holds a seconds
                                  count, when did the count start
                                  (assuming the USRP is synched to UTC
                                  via the GPSDO)?  Restated once more,
                                  if I get back 0, what time is it?<br>
                                  <br>
                                </div>
                                I'm assuming that once synched, the USRP
                                is just using seconds after Unix epoch
                                (this would be logical), but would like
                                to confirm this.<br>
                                <div>
                                  <div class="gmail_extra"><br>
                                    <div class="gmail_quote">On Wed, Dec
                                      10, 2014 at 4:11 PM, Marcus D.
                                      Leech via USRP-users <span
                                        dir="ltr"><<a
                                          moz-do-not-send="true"
                                          href="mailto:usrp-users@lists.ettus.com"
                                          target="_blank">usrp-users@lists.ettus.com</a>></span>
                                      wrote:<br>
                                      <blockquote class="gmail_quote"
                                        style="margin:0 0 0
                                        .8ex;border-left:1px #ccc
                                        solid;padding-left:1ex">
                                        <div bgcolor="#FFFFFF"
                                          text="#000000"><span>
                                            <div>On 12/10/2014 04:02 PM,
                                              Peter Witkowski via
                                              USRP-users wrote:<br>
                                            </div>
                                            <blockquote type="cite">
                                              <div dir="ltr">
                                                <div>
                                                  <div>Thanks for the
                                                    info thus far.  That
                                                    explains a lot and
                                                    at least I know I
                                                    don't have to worry
                                                    about conversions
                                                    from UTC to GPS
                                                    time.<br>
                                                    <br>
                                                  </div>
                                                  So now that it looks
                                                  like the USRP is using
                                                  UTC, when I get a
                                                  time_spec_t structure
                                                  back from it (or pass
                                                  it one as a start time
                                                  in
                                                  issue_stream_cmd()),
                                                  what does the
                                                  time_spec_t structure
                                                  hold?  UTC seconds
                                                  after Unix epoch or
                                                  something else
                                                  entirely?<br>
                                                  <br>
                                                </div>
                                                Note all this assumes
                                                that the GPSDO is
                                                working properly and
                                                locked.<br>
                                                <div>
                                                  <div>
                                                    <div
                                                      class="gmail_extra"><br>
                                                    </div>
                                                  </div>
                                                </div>
                                              </div>
                                            </blockquote>
                                          </span><a
                                            moz-do-not-send="true"
href="http://files.ettus.com/manual/classuhd_1_1time__spec__t.html#a2bd6c4c8ad7209d219c3ca5ae238fb6e"
                                            target="_blank">http://files.ettus.com/manual/classuhd_1_1time__spec__t.html#a2bd6c4c8ad7209d219c3ca5ae238fb6e</a>
                                          <div>
                                            <div><br>
                                              <br>
                                              <br>
                                              <blockquote type="cite">
                                                <div dir="ltr">
                                                  <div>
                                                    <div>
                                                      <div
                                                        class="gmail_extra">
                                                        <div
                                                          class="gmail_quote">On
                                                          Wed, Dec 10,
                                                          2014 at 3:32
                                                          PM, Perelman,
                                                          Nathan via
                                                          USRP-users <span
                                                          dir="ltr"><<a
moz-do-not-send="true" href="mailto:usrp-users@lists.ettus.com"
                                                          target="_blank">usrp-users@lists.ettus.com</a>></span>
                                                          wrote:<br>
                                                          <blockquote
                                                          class="gmail_quote"
                                                          style="margin:0
                                                          0 0
                                                          .8ex;border-left:1px
                                                          #ccc
                                                          solid;padding-left:1ex">
                                                          <div
                                                          bgcolor="white"
                                                          link="blue"
                                                          vlink="purple"
                                                          lang="EN-US">
                                                          <div>
                                                          <p
                                                          class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">The


                                                          time returned
                                                          via
                                                          get_mboard_sensor(“gps_time”)
                                                          will be UTC
                                                          already
                                                          (assuming the
                                                          GPSDO is
                                                          locked). The
                                                          GPSDO corrects
                                                          for leap
                                                          seconds. If
                                                          you look up
                                                          the GPRMC
                                                          string, you
                                                          can see that
                                                          the time/date
                                                          given are UTC.</span></p>
                                                          <p
                                                          class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">-Nathan</span></p>
                                                          <p
                                                          class="MsoNormal"><a
moz-do-not-send="true"
name="14a365ef98d4b647_14a360b06b44bec8_14a35f4435933d7c_14a35e7fb9b6b53b__MailEndCompose"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span></a></p>
                                                          <div>
                                                          <div
                                                          style="border:none;border-top:solid
                                                          #b5c4df
                                                          1.0pt;padding:3.0pt
                                                          0in 0in 0in">
                                                          <p
                                                          class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext">From:</span></b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext">
                                                          USRP-users
                                                          [mailto:<a
                                                          moz-do-not-send="true"
href="mailto:usrp-users-bounces@lists.ettus.com" target="_blank">usrp-users-bounces@lists.ettus.com</a>]
                                                          <b>On Behalf
                                                          Of </b>Marcus
                                                          D. Leech via
                                                          USRP-users<br>
                                                          <b>Sent:</b>
                                                          Wednesday,
                                                          December 10,
                                                          2014 3:18 PM<br>
                                                          <b>To:</b> <a
moz-do-not-send="true" href="mailto:usrp-users@lists.ettus.com"
                                                          target="_blank">usrp-users@lists.ettus.com</a><br>
                                                          <b>Subject:</b>
                                                          Re:
                                                          [USRP-users]
                                                          time_spec_t
                                                          GPS Time or
                                                          UTC?</span></p>
                                                          </div>
                                                          </div>
                                                          <div>
                                                          <div>
                                                          <div> <br>
                                                          </div>
                                                          <p
                                                          class="MsoNormal">On

                                                          12/10/2014
                                                          03:10 PM,
                                                          Peter
                                                          Witkowski via
                                                          USRP-users
                                                          wrote: </p>
                                                          <div>
                                                          <div>
                                                          <div>
                                                          <div>
                                                          <div>
                                                          <div>
                                                          <div>
                                                          <div>
                                                          <div>
                                                          <p
                                                          class="MsoNormal"
style="margin-bottom:12.0pt">Hello,</p>
                                                          </div>
                                                          <p
                                                          class="MsoNormal"
style="margin-bottom:12.0pt">I have a question regarding the time
                                                          reference used
                                                          by the USRP
                                                          (namely the
                                                          x300).</p>
                                                          </div>
                                                          <p
                                                          class="MsoNormal"
style="margin-bottom:12.0pt">If I call the following UHD API functions
                                                          (see list
                                                          below), what
                                                          time reference
                                                          is used (GPS
                                                          or UTC)?  Does
                                                          the USRP
                                                          itself handle
                                                          leap seconds
                                                          and the delta
                                                          between Unix
                                                          time and the
                                                          time it's
                                                          getting from
                                                          it's GPS
                                                          receiver
                                                          (assuming a
                                                          GPSDO is
                                                          installed and
                                                          locked)?</p>
                                                          </div>
                                                          <p
                                                          class="MsoNormal">1. 

                                                          When I specify
                                                          the
                                                          time_spec_t
                                                          value in
                                                          issue_stream_cmd(),
                                                          what time
                                                          reference is
                                                          the USRP
                                                          expecting? 
                                                          For example,
                                                          do I pass it
                                                          seconds after
                                                          epoch (Unix
                                                          time) or
                                                          something
                                                          else?</p>
                                                          </div>
                                                          <p
                                                          class="MsoNormal">2.

                                                          When I get
                                                          time via
                                                          get_time_last_pps(),
                                                          what is the
                                                          time
                                                          reference?</p>
                                                          </div>
                                                          <p
                                                          class="MsoNormal">3.

                                                          Same question
                                                          as above
                                                          except for
                                                          retrieving
                                                          time via
                                                          get_mboard_sensor("gps_time").</p>
                                                          </div>
                                                          <p
                                                          class="MsoNormal"
style="margin-bottom:12.0pt">4.  When I get samples from the sensor
                                                          using recv(),
                                                          what time
                                                          reference is
                                                          used for the
                                                          time_spec_t
                                                          timestamp in
                                                          the
                                                          rx_metadata_t
                                                          structure?  I
                                                          understand
                                                          that is the
                                                          timestamp of
                                                          the first
                                                          sample, but is
                                                          the timestamp
                                                          seconds after
                                                          epoch (i.e.
                                                          Unix time) or
                                                          based on
                                                          something
                                                          else?</p>
                                                          </div>
                                                          <p
                                                          class="MsoNormal"
style="margin-bottom:12.0pt">Just wondering if I need to worry about
                                                          translating
                                                          between GPS
                                                          seconds and
                                                          Unix seconds
                                                          or something
                                                          similar.</p>
                                                          </div>
                                                          <p
                                                          class="MsoNormal">Thanks

                                                          in advance for
                                                          the help.<br
                                                          clear="all">
                                                          </p>
                                                          <div>
                                                          <div>
                                                          <div>
                                                          <div>
                                                          <div>
                                                          <div>
                                                          <div>
                                                          <div>
                                                          <div>
                                                          <p
                                                          class="MsoNormal"><br>
                                                          -- </p>
                                                          <div>
                                                          <p
                                                          class="MsoNormal">Peter


                                                          Witkowski<br>
                                                          <a
                                                          moz-do-not-send="true"
href="mailto:pwitkowski@gmail.com" target="_blank">pwitkowski@gmail.com</a></p>
                                                          </div>
                                                          </div>
                                                          </div>
                                                          </div>
                                                          </div>
                                                          </div>
                                                          </div>
                                                          </div>
                                                          </div>
                                                          </div>
                                                          </div>
                                                          <pre> </pre>
                                                          <pre> </pre>
                                                          <pre>_______________________________________________</pre>
                                                          <pre>USRP-users mailing list</pre>
                                                          <pre><a moz-do-not-send="true" href="mailto:USRP-users@lists.ettus.com" target="_blank">USRP-users@lists.ettus.com</a></pre>
                                                          <pre><a moz-do-not-send="true" href="http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com" target="_blank">http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com</a></pre>
                                                          <p
                                                          class="MsoNormal">The

                                                          USRP doesn't
                                                          actually care,
                                                          or know, about
                                                          epoch-based
                                                          time
                                                          systems.   The
                                                          TOD clock in
                                                          USRPs is just
                                                          a wide counter
                                                          that
                                                          increments at<br>
                                                            the master
                                                          clock rate.<br>
                                                          <br>
                                                          The only
                                                          requirement in
                                                          most cases is
                                                          that everybody
                                                          in a
                                                          collection of
                                                          USRPs agrees
                                                          on the
                                                          interpretation
                                                          of time.  The
                                                          gps_time
                                                          returned in
                                                          the<br>
                                                            sensor is
                                                          just parsed
                                                          from the NMEA
                                                          data, as far
                                                          as I know,
                                                          without any
                                                          further
                                                          manipulation
                                                          to make it
                                                          consistent
                                                          with (for
                                                          example) Unix
                                                          epoch<br>
                                                            time or any
                                                          other time
                                                          system.<br>
                                                          <br>
                                                          In many cases,
                                                          applications
                                                          that don't
                                                          care about
                                                          time-as-it-relates-to-the-rest-of-the-world,
                                                          they load the
                                                          TOD registers
                                                          in a cluster
                                                          of USRPs<br>
                                                            with 0, so
                                                          that the TOD
                                                          clock becomes
                                                          kind of a
                                                          "mission
                                                          elapsed
                                                          timer".<br>
                                                          <br>
                                                          <br>
                                                          <br>
                                                          <br>
                                                          </p>
                                                          <pre>-- </pre>
                                                          <pre>Marcus Leech</pre>
                                                          <pre>Principal Investigator</pre>
                                                          <pre>Shirleys Bay Radio Astronomy Consortium</pre>
                                                          <pre><a moz-do-not-send="true" href="http://www.sbrac.org/" target="_blank">http://www.sbrac.org</a></pre>
                                                          </div>
                                                          </div>
                                                          </div>
                                                          </div>
                                                          <br>
_______________________________________________<br>
                                                          USRP-users
                                                          mailing list<br>
                                                          <a
                                                          moz-do-not-send="true"
href="mailto:USRP-users@lists.ettus.com" target="_blank">USRP-users@lists.ettus.com</a><br>
                                                          <a
                                                          moz-do-not-send="true"
href="http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com"
target="_blank">http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com</a><br>
                                                          <br>
                                                          </blockquote>
                                                        </div>
                                                        <br>
                                                        <br clear="all">
                                                        <br>
                                                        -- <br>
                                                        <div>Peter
                                                          Witkowski<br>
                                                          <a
                                                          moz-do-not-send="true"
href="mailto:pwitkowski@gmail.com" target="_blank">pwitkowski@gmail.com</a></div>
                                                      </div>
                                                    </div>
                                                  </div>
                                                </div>
                                                <br>
                                                <fieldset></fieldset>
                                                <br>
                                                <pre>_______________________________________________
USRP-users mailing list
<a moz-do-not-send="true" href="mailto:USRP-users@lists.ettus.com" target="_blank">USRP-users@lists.ettus.com</a>
<a moz-do-not-send="true" href="http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com" target="_blank">http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com</a>
</pre>
                                              </blockquote>
                                              <br>
                                            </div>
                                          </div>
                                        </div>
                                        <br>
_______________________________________________<br>
                                        USRP-users mailing list<br>
                                        <a moz-do-not-send="true"
                                          href="mailto:USRP-users@lists.ettus.com"
                                          target="_blank">USRP-users@lists.ettus.com</a><br>
                                        <a moz-do-not-send="true"
href="http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com"
                                          target="_blank">http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com</a><br>
                                        <br>
                                      </blockquote>
                                    </div>
                                    <br>
                                    <br clear="all">
                                    <br>
                                    -- <br>
                                    <div>Peter Witkowski<br>
                                      <a moz-do-not-send="true"
                                        href="mailto:pwitkowski@gmail.com"
                                        target="_blank">pwitkowski@gmail.com</a></div>
                                  </div>
                                </div>
                              </div>
_______________________________________________<br>
                              USRP-users mailing list<br>
                              <a moz-do-not-send="true"
                                href="mailto:USRP-users@lists.ettus.com"
                                target="_blank">USRP-users@lists.ettus.com</a><br>
                              <a moz-do-not-send="true"
href="http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com"
                                target="_blank">http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com</a><br>
                            </blockquote>
                          </div>
                          <br>
                        </div>
                      </blockquote>
                      <br>
                    </div>
                  </div>
                </div>
              </blockquote>
            </div>
            <br>
            <br clear="all">
            <br>
            -- <br>
            <div class="gmail_signature">Peter Witkowski<br>
              <a moz-do-not-send="true"
                href="mailto:pwitkowski@gmail.com">pwitkowski@gmail.com</a></div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>