1010import  numpy  as  np 
1111from  ni .protobuf .types  import  (
1212    array_pb2 ,
13+     precision_duration_pb2 ,
14+     precision_duration_conversion ,
1315    precision_timestamp_pb2 ,
1416    precision_timestamp_conversion ,
1517    scalar_conversion ,
@@ -379,7 +381,13 @@ def to_python_value(
379381
380382
381383class  BTDateTimeConverter (Converter [bt .DateTime , precision_timestamp_pb2 .PrecisionTimestamp ]):
382-     """A converter for bintime.DateTime types.""" 
384+     """A converter for bintime.DateTime types. 
385+ 
386+     .. note:: The nipanel package will always convert PrecisionTimestamp messages to 
387+         hightime.datetime objects using HTDateTimeConverter. To use bintime.DateTime 
388+         values in a panel, you must pass a bintime.DateTime value for the default_value 
389+         parameter of the get_value() method on the panel. 
390+     """ 
383391
384392    @property  
385393    def  python_type (self ) ->  type :
@@ -391,6 +399,16 @@ def protobuf_message(self) -> Type[precision_timestamp_pb2.PrecisionTimestamp]:
391399        """The type-specific protobuf message for the Python type.""" 
392400        return  precision_timestamp_pb2 .PrecisionTimestamp 
393401
402+     @property  
403+     def  protobuf_typename (self ) ->  str :
404+         """The protobuf name for the type.""" 
405+         # Override the base class here because there can only be one converter that 
406+         # converts PrecisionTimestamp objects. Since there are two converters that convert 
407+         # to PrecisionTimestamp, we have to choose one to handle conversion from protobuf. 
408+         # For the purposes of nipanel, we'll convert PrecisionTimestamp messages to 
409+         # hightime.datetime. See HTDateTimeConverter. 
410+         return  "PrecisionTimestamp_Placeholder" 
411+ 
394412    def  to_protobuf_message (
395413        self , python_value : bt .DateTime 
396414    ) ->  precision_timestamp_pb2 .PrecisionTimestamp :
@@ -404,34 +422,60 @@ def to_python_value(
404422        return  precision_timestamp_conversion .bintime_datetime_from_protobuf (protobuf_message )
405423
406424
407- class  HTDateTimeConverter (Converter [ht . datetime ,  precision_timestamp_pb2 . PrecisionTimestamp ]):
408-     """A converter for hightime.datetime objects . 
425+ class  BTTimeDeltaConverter (Converter [bt . TimeDelta ,  precision_duration_pb2 . PrecisionDuration ]):
426+     """A converter for bintime.TimeDelta types . 
409427
410-     .. note:: The nipanel package will always convert PrecisionTimestamp  messages to 
411-         bintime.DateTime  objects using BTDateTimeConverter . To use hightime.datetime  
412-         values in a panel, you must pass a hightime.datetime  value for the default_value 
428+     .. note:: The nipanel package will always convert PrecisionDuration  messages to 
429+         hightime.timedelta  objects using HTTimeDeltaConverter . To use bintime.TimeDelta  
430+         values in a panel, you must pass a bintime.TimeDelta  value for the default_value 
413431        parameter of the get_value() method on the panel. 
414432    """ 
415433
416434    @property  
417435    def  python_type (self ) ->  type :
418436        """The Python type that this converter handles.""" 
419-         return  ht . datetime 
437+         return  bt . TimeDelta 
420438
421439    @property  
422-     def  protobuf_message (self ) ->  Type [precision_timestamp_pb2 . PrecisionTimestamp ]:
440+     def  protobuf_message (self ) ->  Type [precision_duration_pb2 . PrecisionDuration ]:
423441        """The type-specific protobuf message for the Python type.""" 
424-         return  precision_timestamp_pb2 . PrecisionTimestamp 
442+         return  precision_duration_pb2 . PrecisionDuration 
425443
426444    @property  
427445    def  protobuf_typename (self ) ->  str :
428446        """The protobuf name for the type.""" 
429447        # Override the base class here because there can only be one converter that 
430-         # converts PrecisionTimestamp objects. Since there are two converters that convert 
431-         # to PrecisionTimestamp, we have to choose one to handle conversion from protobuf. 
432-         # For the purposes of nipanel, we'll convert PrecisionTimestamp messages to 
433-         # bintime.DateTime. See BTDateTimeConverter. 
434-         return  "PrecisionTimestamp_Placeholder" 
448+         # converts PrecisionDuration objects. Since there are two converters that convert 
449+         # to PrecisionDuration, we have to choose one to handle conversion from protobuf. 
450+         # For the purposes of nipanel, we'll convert PrecisionDuration messages to 
451+         # hightime.timedelta. See HTTimeDeltaConverter. 
452+         return  "PrecisionDuration_Placeholder" 
453+ 
454+     def  to_protobuf_message (
455+         self , python_value : bt .TimeDelta 
456+     ) ->  precision_duration_pb2 .PrecisionDuration :
457+         """Convert the Python TimeDelta to a protobuf PrecisionDuration.""" 
458+         return  precision_duration_conversion .bintime_timedelta_to_protobuf (python_value )
459+ 
460+     def  to_python_value (
461+         self , protobuf_message : precision_duration_pb2 .PrecisionDuration 
462+     ) ->  bt .TimeDelta :
463+         """Convert the protobuf PrecisionDuration to a Python TimeDelta.""" 
464+         return  precision_duration_conversion .bintime_timedelta_from_protobuf (protobuf_message )
465+ 
466+ 
467+ class  HTDateTimeConverter (Converter [ht .datetime , precision_timestamp_pb2 .PrecisionTimestamp ]):
468+     """A converter for hightime.datetime objects.""" 
469+ 
470+     @property  
471+     def  python_type (self ) ->  type :
472+         """The Python type that this converter handles.""" 
473+         return  ht .datetime 
474+ 
475+     @property  
476+     def  protobuf_message (self ) ->  Type [precision_timestamp_pb2 .PrecisionTimestamp ]:
477+         """The type-specific protobuf message for the Python type.""" 
478+         return  precision_timestamp_pb2 .PrecisionTimestamp 
435479
436480    def  to_protobuf_message (
437481        self , python_value : ht .datetime 
@@ -446,6 +490,32 @@ def to_python_value(
446490        return  precision_timestamp_conversion .hightime_datetime_from_protobuf (protobuf_message )
447491
448492
493+ class  HTTimeDeltaConverter (Converter [ht .timedelta , precision_duration_pb2 .PrecisionDuration ]):
494+     """A converter for hightime.timedelta objects.""" 
495+ 
496+     @property  
497+     def  python_type (self ) ->  type :
498+         """The Python type that this converter handles.""" 
499+         return  ht .timedelta 
500+ 
501+     @property  
502+     def  protobuf_message (self ) ->  Type [precision_duration_pb2 .PrecisionDuration ]:
503+         """The type-specific protobuf message for the Python type.""" 
504+         return  precision_duration_pb2 .PrecisionDuration 
505+ 
506+     def  to_protobuf_message (
507+         self , python_value : ht .timedelta 
508+     ) ->  precision_duration_pb2 .PrecisionDuration :
509+         """Convert the Python timedelta to a protobuf PrecisionDuration.""" 
510+         return  precision_duration_conversion .hightime_timedelta_to_protobuf (python_value )
511+ 
512+     def  to_python_value (
513+         self , protobuf_message : precision_duration_pb2 .PrecisionDuration 
514+     ) ->  ht .timedelta :
515+         """Convert the protobuf PrecisionDuration to a Python timedelta.""" 
516+         return  precision_duration_conversion .hightime_timedelta_from_protobuf (protobuf_message )
517+ 
518+ 
449519class  ScalarConverter (Converter [Scalar [_AnyScalarType ], scalar_pb2 .Scalar ]):
450520    """A converter for Scalar objects.""" 
451521
0 commit comments