## Revision 45bc5e4a lib/utils.py

b/lib/utils.py
1168 1168
```  return None
```
1169 1169

1170 1170

1171
```def SplitTime(seconds):
```
1171
```def SplitTime(value):
```
1172 1172
```  """Splits time as floating point number into a tuple.
```
1173 1173

1174
```  @param seconds: Time in seconds
```
1175
```  @type seconds: int or float
```
1176
```  @return: Tuple containing (seconds, milliseconds)
```
1174
```  @param value: Time in seconds
```
1175
```  @type value: int or float
```
1176
```  @return: Tuple containing (seconds, microseconds)
```
1177 1177

1178 1178
```  """
```
1179
```  seconds = round(seconds, 3)
```
1180
```  (seconds, fraction) = divmod(seconds, 1.0)
```
1181
```  return (int(seconds), int(round(fraction * 1000, 0)))
```
1179
```  (seconds, microseconds) = divmod(int(value * 1000000), 1000000)
```
1180

1181
```  assert 0 <= seconds, \
```
1182
```    "Seconds must be larger than or equal to 0, but are %s" % seconds
```
1183
```  assert 0 <= microseconds <= 999999, \
```
1184
```    "Microseconds must be 0-999999, but are %s" % microseconds
```
1185

1186
```  return (int(seconds), int(microseconds))
```
1182 1187

1183 1188

1184 1189
```def MergeTime(timetuple):
```
1185 1190
```  """Merges a tuple into time as a floating point number.
```
1186 1191

1187
```  @param timetuple: Time as tuple, (seconds, milliseconds)
```
1192
```  @param timetuple: Time as tuple, (seconds, microseconds)
```
1188 1193
```  @type timetuple: tuple
```
1189 1194
```  @return: Time as a floating point number expressed in seconds
```
1190 1195

1191 1196
```  """
```
1192
```  (seconds, milliseconds) = timetuple
```
1197
```  (seconds, microseconds) = timetuple
```
1193 1198

1194
```  assert 0 <= seconds, "Seconds must be larger than 0"
```
1195
```  assert 0 <= milliseconds <= 999, "Milliseconds must be 0-999"
```
1199
```  assert 0 <= seconds, \
```
1200
```    "Seconds must be larger than or equal to 0, but are %s" % seconds
```
1201
```  assert 0 <= microseconds <= 999999, \
```
1202
```    "Microseconds must be 0-999999, but are %s" % microseconds
```
1196 1203

1197
```  return float(seconds) + (float(1) / 1000 * milliseconds)
```
1204
```  return float(seconds) + (float(microseconds) * 0.000001)
```
1198 1205

1199 1206

1200 1207
```def LockedMethod(fn):
```

Also available in: Unified diff