You pass it a uhd.time_spec. SInce you are using the PC's time, there is
already something you may find convenient: uhd.time_spec.get_system_time()

>>>
Can you do this in python script that I have, or how you do this in python?

If not in python, then the easier thing for me to do may still be trying to
get the time of captured start sample of the data.

Please advise.

Thanks,


For your reference, I am pasting the python code I have:
--------------------------------------------------------------------
class top_block(gr.top_block):

        def __init__(self):
                gr.top_block.__init__(self, "test_1")

                ##################################################
                # Variables
                ##################################################
                self.samp_rate = samp_rate = 10000000

                ##################################################
                # Blocks
                ##################################################
                self.uhd_usrp_source_0 = uhd.usrp_source(
                        device_addr="",
                        stream_args=uhd.stream_args(
                                cpu_format="fc32",
                                channels=range(1),
                        ),
                )
                self.uhd_usrp_source_0.set_subdev_spec("A:B", 0)
                self.uhd_usrp_source_0.set_samp_rate(samp_rate)
                self.uhd_usrp_source_0.set_center_freq(0, 0)
                self.uhd_usrp_source_0.set_gain(0, 0)
                self.gr_skiphead_0 = gr.skiphead(gr.sizeof_gr_complex*1,
10240)
                self.gr_head_0 = gr.head(gr.sizeof_gr_complex*1, 10000000)
                self.gr_file_sink_0 = gr.file_sink(gr.sizeof_gr_complex*1,
"sample_sink.dat")
                self.gr_file_sink_0.set_unbuffered(True)

                ##################################################
                # Connections
                ##################################################
                self.connect((self.gr_head_0, 0), (self.gr_file_sink_0, 0))
                self.connect((self.uhd_usrp_source_0, 0),
(self.gr_skiphead_0, 0))
                self.connect((self.gr_skiphead_0, 0), (self.gr_head_0, 0))

        def get_samp_rate(self):
                return self.samp_rate

        def set_samp_rate(self, samp_rate):
                self.samp_rate = samp_rate
                self.uhd_usrp_source_0.set_samp_rate(self.samp_rate)

if __name__ == '__main__':
        parser = OptionParser(option_class=eng_option, usage="%prog:
[options]")
        (options, args) = parser.parse_args()
        tb = top_block()
        tb.run()




_______________________________________________
Discuss-gnuradio mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to