Closed ThinkontrolSY closed 4 years ago
https://github.com/robinson/gos7/blob/929a8656546f34c7c6196bd31cefefc78ee399e6/helper.go#L170
error code
Year := int(buffer[pos])*256 + int(buffer[pos+1]) Month := int(buffer[pos+2]) Day := int(buffer[pos+3]) Hour := int(buffer[pos+5]) Min := int(buffer[pos+6]) Sec := int(buffer[pos+7]) var nsec int s7.GetValueAt(buffer, pos, &nsec) return time.Date(Year, time.Month(Month), Day, Hour, Min, Sec, nsec, time.UTC)
reference siemen document Date_And_Time format tested code
year := decodeBcd(buffer[0 + pos]) if year >= 90 { year += 1900 } else { year += 2000 } month := decodeBcd(buffer[1 + pos]) day := decodeBcd(buffer[2 + pos]) hour := decodeBcd(buffer[3 + pos]) minute := decodeBcd(buffer[4 + pos]) second := decodeBcd(buffer[5 + pos]) ms := decodeBcd(buffer[6 + pos])*10 + decodeBcd(buffer[7 + pos]>>4) return time.Date(int(year), time.Month(month), day, hour, minute, second, ms*1000000, time.UTC)
https://github.com/robinson/gos7/blob/929a8656546f34c7c6196bd31cefefc78ee399e6/helper.go#L170
error code
reference siemen document Date_And_Time format tested code