targets/typemapping.py
changeset 1835 7533061a6d82
parent 1783 3311eea28d56
child 1847 6198190bc121
equal deleted inserted replaced
1834:cd42b426028b 1835:7533061a6d82
    44     """
    44     """
    45     _fields_ = [("s", c_long),   # tv_sec
    45     _fields_ = [("s", c_long),   # tv_sec
    46                 ("ns", c_long)]  # tv_nsec
    46                 ("ns", c_long)]  # tv_nsec
    47 
    47 
    48 
    48 
    49 def _t(t, u=lambda x: x.value, p=lambda t, x: t(x)): return (t, u, p)
    49 def _t(t, u=lambda x: x.value, p=lambda t, x: t(x)):
       
    50     return (t, u, p)
    50 
    51 
    51 
    52 
    52 def _ttime(): return (IEC_TIME,
    53 def _ttime():
    53                       lambda x: td(0, x.s, x.ns/1000),
    54     return (IEC_TIME,
    54                       lambda t, x: t(x.days * 24 * 3600 + x.seconds, x.microseconds*1000))
    55             lambda x: td(0, x.s, x.ns/1000),
       
    56             lambda t, x: t(x.days * 24 * 3600 + x.seconds, x.microseconds*1000))
    55 
    57 
    56 
    58 
    57 SameEndianessTypeTranslator = {
    59 SameEndianessTypeTranslator = {
    58     "BOOL":       _t(c_uint8, lambda x: x.value != 0),
    60     "BOOL":       _t(c_uint8, lambda x: x.value != 0),
    59     "STEP":       _t(c_uint8),
    61     "STEP":       _t(c_uint8),