@@ -1410,11 +1410,10 @@ func decodeTime2(data []byte, dec uint16) (string, int, error) {
1410
1410
intPart := int64 (0 )
1411
1411
frac := int64 (0 )
1412
1412
switch dec {
1413
- case 1 :
1414
- case 2 :
1413
+ case 1 , 2 :
1415
1414
intPart = int64 (BFixedLengthInt (data [0 :3 ])) - TIMEF_INT_OFS
1416
1415
frac = int64 (data [3 ])
1417
- if intPart < 0 && frac > 0 {
1416
+ if intPart < 0 && frac != 0 {
1418
1417
/*
1419
1418
Negative values are stored with reverse fractional part order,
1420
1419
for binary sort compatibility.
@@ -1436,11 +1435,10 @@ func decodeTime2(data []byte, dec uint16) (string, int, error) {
1436
1435
frac -= 0x100 /* -(0x100 - frac) */
1437
1436
}
1438
1437
tmp = intPart << 24 + frac * 10000
1439
- case 3 :
1440
- case 4 :
1438
+ case 3 , 4 :
1441
1439
intPart = int64 (BFixedLengthInt (data [0 :3 ])) - TIMEF_INT_OFS
1442
1440
frac = int64 (binary .BigEndian .Uint16 (data [3 :5 ]))
1443
- if intPart < 0 && frac > 0 {
1441
+ if intPart < 0 && frac != 0 {
1444
1442
/*
1445
1443
Fix reverse fractional part order: "0x10000 - frac".
1446
1444
See comments for FSP=1 and FSP=2 above.
@@ -1450,9 +1448,9 @@ func decodeTime2(data []byte, dec uint16) (string, int, error) {
1450
1448
}
1451
1449
tmp = intPart << 24 + frac * 100
1452
1450
1453
- case 5 :
1454
- case 6 :
1451
+ case 5 , 6 :
1455
1452
tmp = int64 (BFixedLengthInt (data [0 :6 ])) - TIMEF_OFS
1453
+ return timeFormat (tmp , n )
1456
1454
default :
1457
1455
intPart = int64 (BFixedLengthInt (data [0 :3 ])) - TIMEF_INT_OFS
1458
1456
tmp = intPart << 24
@@ -1462,6 +1460,10 @@ func decodeTime2(data []byte, dec uint16) (string, int, error) {
1462
1460
return "00:00:00" , n , nil
1463
1461
}
1464
1462
1463
+ return timeFormat (tmp , n )
1464
+ }
1465
+
1466
+ func timeFormat (tmp int64 , n int ) (string , int , error ) {
1465
1467
hms := int64 (0 )
1466
1468
sign := ""
1467
1469
if tmp < 0 {
0 commit comments