@@ -298,29 +298,17 @@ def bytes_le(self):
298298
299299 @property
300300 def fields (self ):
301- if self .version == 6 :
302- # the first field should be a 32-bit integer
303- return (self .time_hi , self .time_mid , self .time_hi_version ,
304- self .clock_seq_hi_variant , self .clock_seq_low , self .node )
305301 return (self .time_low , self .time_mid , self .time_hi_version ,
306302 self .clock_seq_hi_variant , self .clock_seq_low , self .node )
307303
308304 @property
309305 def time_low (self ):
310- if self .version == 6 :
311- return (self .int >> 64 ) & 0x0fff
312306 return self .int >> 96
313307
314308 @property
315309 def time_mid (self ):
316310 return (self .int >> 80 ) & 0xffff
317311
318- @property
319- def time_hi (self ):
320- if self .version == 6 :
321- return self .int >> 96
322- return (self .int >> 64 ) & 0x0fff
323-
324312 @property
325313 def time_hi_version (self ):
326314 return (self .int >> 64 ) & 0xffff
@@ -336,8 +324,16 @@ def clock_seq_low(self):
336324 @property
337325 def time (self ):
338326 if self .version == 6 :
339- return (self .time_hi << 28 ) | (self .time_mid << 12 ) | self .time_low
340- return (self .time_hi << 48 ) | (self .time_mid << 32 ) | self .time_low
327+ # In version 1, the first field contains the 32 MSBs
328+ # and the field after the version contains the 12 LSBs.
329+ time_hi = self .int >> 96 # == fields[0]
330+ time_lo = (self .int >> 64 ) & 0x0fff # == fields[2] & 0x0fff
331+ return time_hi << 28 | (self .time_mid << 12 ) | time_lo
332+ else :
333+ # In version 1, the first field contains the 32 LSBs
334+ # and the field after the version contains the 12 MSBs.
335+ time_hi = (self .int >> 64 ) & 0x0fff # == fields[2] & 0x0fff
336+ return time_hi << 48 | (self .time_mid << 32 ) | self .time_low
341337
342338 @property
343339 def clock_seq (self ):
0 commit comments