timespec

  1# This file was automatically generated by SWIG (https://www.swig.org).
  2# Version 4.2.1
  3#
  4# Do not make changes to this file unless you know what you are doing - modify
  5# the SWIG interface file instead.
  6
  7from sys import version_info as _swig_python_version_info
  8from mock_rtems import _timespec as _timespec
  9
 10try:
 11    import builtins as __builtin__
 12except ImportError:
 13    import __builtin__
 14
 15def _swig_repr(self):
 16    try:
 17        strthis = "proxy of " + self.this.__repr__()
 18    except __builtin__.Exception:
 19        strthis = ""
 20    return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
 21
 22
 23def _swig_setattr_nondynamic_instance_variable(set):
 24    def set_instance_attr(self, name, value):
 25        if name == "this":
 26            set(self, name, value)
 27        elif name == "thisown":
 28            self.this.own(value)
 29        elif hasattr(self, name) and isinstance(getattr(type(self), name), property):
 30            set(self, name, value)
 31        else:
 32            raise AttributeError("You cannot add instance attributes to %s" % self)
 33    return set_instance_attr
 34
 35
 36def _swig_setattr_nondynamic_class_variable(set):
 37    def set_class_attr(cls, name, value):
 38        if hasattr(cls, name) and not isinstance(getattr(cls, name), property):
 39            set(cls, name, value)
 40        else:
 41            raise AttributeError("You cannot add class attributes to %s" % cls)
 42    return set_class_attr
 43
 44
 45def _swig_add_metaclass(metaclass):
 46    """Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass"""
 47    def wrapper(cls):
 48        return metaclass(cls.__name__, cls.__bases__, cls.__dict__.copy())
 49    return wrapper
 50
 51
 52class _SwigNonDynamicMeta(type):
 53    """Meta class to enforce nondynamic attributes (no new attributes) for a class"""
 54    __setattr__ = _swig_setattr_nondynamic_class_variable(type.__setattr__)
 55
 56
 57
 58def rtems_timespec_is_valid(time):
 59    r"""
 60    Is timespec valid
 61
 62    This method determines the validity of a timespec.
 63
 64    :type time: struct timespec, in
 65    :param time: is the timespec instance to validate.
 66    """
 67    return _timespec.rtems_timespec_is_valid(time)
 68
 69def rtems_timespec_less_than(lhs, rhs):
 70    r"""
 71    Timespec less than operator.
 72
 73    This method is the less than operator for timespecs.
 74
 75    :type lhs: struct timespec, in
 76    :param lhs: is the left hand side timespec
 77    :type rhs: struct timespec, in
 78    :param rhs: is the right hand side timespec
 79    """
 80    return _timespec.rtems_timespec_less_than(lhs, rhs)
 81
 82def rtems_timespec_add_to(time, add):
 83    r"""
 84    Add to a timespec.
 85
 86    This routine adds two timespecs.  The second argument is added
 87    to the first.
 88
 89    :type time: struct timespec, in
 90    :param time: is the base time to be added to
 91    :type add: struct timespec, in
 92    :param add: is the timespec to add to the first argument
 93
 94    :rtype: time_t
 95    :return: This method returns the number of seconds *time* increased by.
 96    """
 97    return _timespec.rtems_timespec_add_to(time, add)
 98
 99def rtems_timespec_to_ticks(time):
100    r"""
101    Convert timespec to number of ticks.
102
103    This routine convert the *time* timespec to the corresponding number
104    of clock ticks.
105
106    :type time: struct timespec, in
107    :param time: is the time to be converted
108
109    :rtype: uint32_t
110    :return: This method returns the number of ticks computed.
111    """
112    return _timespec.rtems_timespec_to_ticks(time)
113
114def rtems_timespec_from_ticks(ticks, time):
115    r"""
116    Convert ticks to timespec.
117
118    This routine converts the *ticks* value to the corresponding
119    timespec format *time*.
120
121    :type time: struct timespec, in
122    :param time: is the timespec format time result
123    :type ticks: uint32_t, in
124    :param ticks: is the number of ticks to convert
125    """
126    return _timespec.rtems_timespec_from_ticks(ticks, time)
127
128def rtems_timespec_subtract(start, end, result):
129    r"""
130    Subtract two timespec.
131
132    This routine subtracts two timespecs.  *result* is set to
133    *end* - *start*.
134
135    :type start: struct timespec, in
136    :param start: is the starting time
137    :type end: struct timespec, in
138    :param end: is the ending time
139    :type result: struct timespec, in
140    :param result: is the difference between starting and ending time.
141
142    :rtype: void
143    :return: This method fills in *result*.
144    """
145    return _timespec.rtems_timespec_subtract(start, end, result)
146
147def rtems_timespec_divide_by_integer(time, iterations, result):
148    r"""
149    Divide timespec by integer.
150
151    This routine divides a timespec by an integer value.  The expected
152    use is to assist in benchmark calculations where you typically
153    divide a duration by a number of iterations.
154
155    :type time: struct timespec, in
156    :param time: is the total
157    :type iterations: uint32_t, in
158    :param iterations: is the number of iterations
159    :type result: struct timespec, in
160    :param result: is the average time.
161
162    :rtype: void
163    :return: This method fills in *result*.
164    """
165    return _timespec.rtems_timespec_divide_by_integer(time, iterations, result)
166
167def rtems_timespec_divide(lhs, rhs, ival_percentage, fval_percentage):
168    r"""
169    Divide timespec.
170
171    This routine divides a timespec by another timespec.  The
172    intended use is for calculating percentages to three decimal points.
173
174    :type lhs: struct timespec, in
175    :param lhs: is the left hand number
176    :type rhs: struct timespec, in
177    :param rhs: is the right hand number
178    :type ival_percentage: uint32_t, in
179    :param ival_percentage: is the integer portion of the average
180    :type fval_percentage: uint32_t, in
181    :param fval_percentage: is the thousandths of percentage
182
183    :rtype: void
184    :return: This method fills in *result*.
185    """
186    return _timespec.rtems_timespec_divide(lhs, rhs, ival_percentage, fval_percentage)
187
188def rtems_timespec_set(_time, _seconds, _nanoseconds):
189    r"""
190    Set timespec to seconds nanosecond.
191
192    This method sets the timespec to the specified seconds and nanoseconds
193    value.
194
195    :type _time: struct timespec, in
196    :param _time: points to the timespec instance to validate.
197    :type _seconds: time_t, in
198    :param _seconds: is the seconds portion of the timespec
199    :type _nanoseconds: uint32_t, in
200    :param _nanoseconds: is the nanoseconds portion of the timespec
201    """
202    return _timespec.rtems_timespec_set(_time, _seconds, _nanoseconds)
203
204def rtems_timespec_zero(_time):
205    r"""
206    Zero timespec.
207
208    This method sets the timespec to zero.
209    value.
210
211    :type _time: struct timespec, in
212    :param _time: points to the timespec instance to zero.
213    """
214    return _timespec.rtems_timespec_zero(_time)
215
216def rtems_timespec_get_seconds(_time):
217    r"""
218    Get seconds portion of timespec.
219
220    This method returns the seconds portion of the specified timespec
221
222    :type _time: struct timespec, in
223    :param _time: points to the timespec
224
225    :rtype: time_t
226    :return: The seconds portion of *_time*.
227    """
228    return _timespec.rtems_timespec_get_seconds(_time)
229
230def rtems_timespec_get_nanoseconds(_time):
231    r"""
232    Get nanoseconds portion of timespec.
233
234    This method returns the nanoseconds portion of the specified timespec
235
236    :type _time: struct timespec, in
237    :param _time: points to the timespec
238
239    :rtype: uint32_t
240    :return: The nanoseconds portion of *_time*.
241    """
242    return _timespec.rtems_timespec_get_nanoseconds(_time)
243
244def rtems_timespec_greater_than(_lhs, _rhs):
245    r"""
246    Timespec greater than operator.
247
248    This method is the greater than operator for timespecs.
249
250    :type _lhs: struct timespec, in
251    :param _lhs: is the left hand side timespec
252    :type _rhs: struct timespec, in
253    :param _rhs: is the right hand side timespec
254    """
255    return _timespec.rtems_timespec_greater_than(_lhs, _rhs)
256
257def rtems_timespec_equal_to(lhs, rhs):
258    r"""
259    Timespec equal to Operator
260
261    This method is the is equal to than operator for timespecs.
262
263    :type lhs: struct timespec, in
264    :param lhs: is the left hand side timespec
265    :type rhs: struct timespec, in
266    :param rhs: is the right hand side timespec
267    """
268    return _timespec.rtems_timespec_equal_to(lhs, rhs)
def rtems_timespec_is_valid(time):
59def rtems_timespec_is_valid(time):
60    r"""
61    Is timespec valid
62
63    This method determines the validity of a timespec.
64
65    :type time: struct timespec, in
66    :param time: is the timespec instance to validate.
67    """
68    return _timespec.rtems_timespec_is_valid(time)

Is timespec valid

This method determines the validity of a timespec.

Parameters
  • time: is the timespec instance to validate.
def rtems_timespec_less_than(lhs, rhs):
70def rtems_timespec_less_than(lhs, rhs):
71    r"""
72    Timespec less than operator.
73
74    This method is the less than operator for timespecs.
75
76    :type lhs: struct timespec, in
77    :param lhs: is the left hand side timespec
78    :type rhs: struct timespec, in
79    :param rhs: is the right hand side timespec
80    """
81    return _timespec.rtems_timespec_less_than(lhs, rhs)

Timespec less than operator.

This method is the less than operator for timespecs.

Parameters
  • lhs: is the left hand side timespec
  • rhs: is the right hand side timespec
def rtems_timespec_add_to(time, add):
83def rtems_timespec_add_to(time, add):
84    r"""
85    Add to a timespec.
86
87    This routine adds two timespecs.  The second argument is added
88    to the first.
89
90    :type time: struct timespec, in
91    :param time: is the base time to be added to
92    :type add: struct timespec, in
93    :param add: is the timespec to add to the first argument
94
95    :rtype: time_t
96    :return: This method returns the number of seconds *time* increased by.
97    """
98    return _timespec.rtems_timespec_add_to(time, add)

Add to a timespec.

This routine adds two timespecs. The second argument is added to the first.

Parameters
  • time: is the base time to be added to
  • add: is the timespec to add to the first argument
Returns

This method returns the number of seconds time increased by.

def rtems_timespec_to_ticks(time):
100def rtems_timespec_to_ticks(time):
101    r"""
102    Convert timespec to number of ticks.
103
104    This routine convert the *time* timespec to the corresponding number
105    of clock ticks.
106
107    :type time: struct timespec, in
108    :param time: is the time to be converted
109
110    :rtype: uint32_t
111    :return: This method returns the number of ticks computed.
112    """
113    return _timespec.rtems_timespec_to_ticks(time)

Convert timespec to number of ticks.

This routine convert the time timespec to the corresponding number of clock ticks.

Parameters
  • time: is the time to be converted
Returns

This method returns the number of ticks computed.

def rtems_timespec_from_ticks(ticks, time):
115def rtems_timespec_from_ticks(ticks, time):
116    r"""
117    Convert ticks to timespec.
118
119    This routine converts the *ticks* value to the corresponding
120    timespec format *time*.
121
122    :type time: struct timespec, in
123    :param time: is the timespec format time result
124    :type ticks: uint32_t, in
125    :param ticks: is the number of ticks to convert
126    """
127    return _timespec.rtems_timespec_from_ticks(ticks, time)

Convert ticks to timespec.

This routine converts the ticks value to the corresponding timespec format time.

Parameters
  • time: is the timespec format time result
  • ticks: is the number of ticks to convert
def rtems_timespec_subtract(start, end, result):
129def rtems_timespec_subtract(start, end, result):
130    r"""
131    Subtract two timespec.
132
133    This routine subtracts two timespecs.  *result* is set to
134    *end* - *start*.
135
136    :type start: struct timespec, in
137    :param start: is the starting time
138    :type end: struct timespec, in
139    :param end: is the ending time
140    :type result: struct timespec, in
141    :param result: is the difference between starting and ending time.
142
143    :rtype: void
144    :return: This method fills in *result*.
145    """
146    return _timespec.rtems_timespec_subtract(start, end, result)

Subtract two timespec.

This routine subtracts two timespecs. result is set to end - start.

Parameters
  • start: is the starting time
  • end: is the ending time
  • result: is the difference between starting and ending time.
Returns

This method fills in result.

def rtems_timespec_divide_by_integer(time, iterations, result):
148def rtems_timespec_divide_by_integer(time, iterations, result):
149    r"""
150    Divide timespec by integer.
151
152    This routine divides a timespec by an integer value.  The expected
153    use is to assist in benchmark calculations where you typically
154    divide a duration by a number of iterations.
155
156    :type time: struct timespec, in
157    :param time: is the total
158    :type iterations: uint32_t, in
159    :param iterations: is the number of iterations
160    :type result: struct timespec, in
161    :param result: is the average time.
162
163    :rtype: void
164    :return: This method fills in *result*.
165    """
166    return _timespec.rtems_timespec_divide_by_integer(time, iterations, result)

Divide timespec by integer.

This routine divides a timespec by an integer value. The expected use is to assist in benchmark calculations where you typically divide a duration by a number of iterations.

Parameters
  • time: is the total
  • iterations: is the number of iterations
  • result: is the average time.
Returns

This method fills in result.

def rtems_timespec_divide(lhs, rhs, ival_percentage, fval_percentage):
168def rtems_timespec_divide(lhs, rhs, ival_percentage, fval_percentage):
169    r"""
170    Divide timespec.
171
172    This routine divides a timespec by another timespec.  The
173    intended use is for calculating percentages to three decimal points.
174
175    :type lhs: struct timespec, in
176    :param lhs: is the left hand number
177    :type rhs: struct timespec, in
178    :param rhs: is the right hand number
179    :type ival_percentage: uint32_t, in
180    :param ival_percentage: is the integer portion of the average
181    :type fval_percentage: uint32_t, in
182    :param fval_percentage: is the thousandths of percentage
183
184    :rtype: void
185    :return: This method fills in *result*.
186    """
187    return _timespec.rtems_timespec_divide(lhs, rhs, ival_percentage, fval_percentage)

Divide timespec.

This routine divides a timespec by another timespec. The intended use is for calculating percentages to three decimal points.

Parameters
  • lhs: is the left hand number
  • rhs: is the right hand number
  • ival_percentage: is the integer portion of the average
  • fval_percentage: is the thousandths of percentage
Returns

This method fills in result.

def rtems_timespec_set(_time, _seconds, _nanoseconds):
189def rtems_timespec_set(_time, _seconds, _nanoseconds):
190    r"""
191    Set timespec to seconds nanosecond.
192
193    This method sets the timespec to the specified seconds and nanoseconds
194    value.
195
196    :type _time: struct timespec, in
197    :param _time: points to the timespec instance to validate.
198    :type _seconds: time_t, in
199    :param _seconds: is the seconds portion of the timespec
200    :type _nanoseconds: uint32_t, in
201    :param _nanoseconds: is the nanoseconds portion of the timespec
202    """
203    return _timespec.rtems_timespec_set(_time, _seconds, _nanoseconds)

Set timespec to seconds nanosecond.

This method sets the timespec to the specified seconds and nanoseconds value.

Parameters
  • _time: points to the timespec instance to validate.
  • _seconds: is the seconds portion of the timespec
  • _nanoseconds: is the nanoseconds portion of the timespec
def rtems_timespec_zero(_time):
205def rtems_timespec_zero(_time):
206    r"""
207    Zero timespec.
208
209    This method sets the timespec to zero.
210    value.
211
212    :type _time: struct timespec, in
213    :param _time: points to the timespec instance to zero.
214    """
215    return _timespec.rtems_timespec_zero(_time)

Zero timespec.

This method sets the timespec to zero. value.

Parameters
  • _time: points to the timespec instance to zero.
def rtems_timespec_get_seconds(_time):
217def rtems_timespec_get_seconds(_time):
218    r"""
219    Get seconds portion of timespec.
220
221    This method returns the seconds portion of the specified timespec
222
223    :type _time: struct timespec, in
224    :param _time: points to the timespec
225
226    :rtype: time_t
227    :return: The seconds portion of *_time*.
228    """
229    return _timespec.rtems_timespec_get_seconds(_time)

Get seconds portion of timespec.

This method returns the seconds portion of the specified timespec

Parameters
  • _time: points to the timespec
Returns

The seconds portion of _time.

def rtems_timespec_get_nanoseconds(_time):
231def rtems_timespec_get_nanoseconds(_time):
232    r"""
233    Get nanoseconds portion of timespec.
234
235    This method returns the nanoseconds portion of the specified timespec
236
237    :type _time: struct timespec, in
238    :param _time: points to the timespec
239
240    :rtype: uint32_t
241    :return: The nanoseconds portion of *_time*.
242    """
243    return _timespec.rtems_timespec_get_nanoseconds(_time)

Get nanoseconds portion of timespec.

This method returns the nanoseconds portion of the specified timespec

Parameters
  • _time: points to the timespec
Returns

The nanoseconds portion of _time.

def rtems_timespec_greater_than(_lhs, _rhs):
245def rtems_timespec_greater_than(_lhs, _rhs):
246    r"""
247    Timespec greater than operator.
248
249    This method is the greater than operator for timespecs.
250
251    :type _lhs: struct timespec, in
252    :param _lhs: is the left hand side timespec
253    :type _rhs: struct timespec, in
254    :param _rhs: is the right hand side timespec
255    """
256    return _timespec.rtems_timespec_greater_than(_lhs, _rhs)

Timespec greater than operator.

This method is the greater than operator for timespecs.

Parameters
  • _lhs: is the left hand side timespec
  • _rhs: is the right hand side timespec
def rtems_timespec_equal_to(lhs, rhs):
258def rtems_timespec_equal_to(lhs, rhs):
259    r"""
260    Timespec equal to Operator
261
262    This method is the is equal to than operator for timespecs.
263
264    :type lhs: struct timespec, in
265    :param lhs: is the left hand side timespec
266    :type rhs: struct timespec, in
267    :param rhs: is the right hand side timespec
268    """
269    return _timespec.rtems_timespec_equal_to(lhs, rhs)

Timespec equal to Operator

This method is the is equal to than operator for timespecs.

Parameters
  • lhs: is the left hand side timespec
  • rhs: is the right hand side timespec