// Code generated by modernc.org/undup from the per-target sqlite_*.go files; DO NOT EDIT. //go:build (linux && arm) || (linux && arm64) || (linux && ppc64le) || (linux && riscv64) package sqlite3 import ( "unsafe" "modernc.org/libc" ) // C documentation // // /* // ** Parse times of the form HH:MM or HH:MM:SS or HH:MM:SS.FFFF. // ** The HH, MM, and SS must each be exactly 2 digits. The // ** fractional seconds FFFF can be one or more digits. // ** // ** Return 1 if there is a parsing error and 0 on success. // */ func _parseHhMmSs(tls *libc.TLS, zDate uintptr, p uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var ms, rScale float64 var _ /* h at bp+0 */ int32 var _ /* m at bp+4 */ int32 var _ /* s at bp+8 */ int32 _, _ = ms, rScale ms = float64(0) if _getDigits(tls, zDate, __ccgo_ts+1204, libc.VaList(bp+24, bp, bp+4)) != int32(2) { return int32(1) } zDate = zDate + uintptr(5) if libc.Int32FromUint8(**(**uint8)(__ccgo_up(zDate))) == int32(':') { zDate = zDate + 1 if _getDigits(tls, zDate, __ccgo_ts+1212, libc.VaList(bp+24, bp+8)) != int32(1) { return int32(1) } zDate = zDate + uintptr(2) if libc.Int32FromUint8(**(**uint8)(__ccgo_up(zDate))) == int32('.') && libc.Int32FromUint8(_sqlite3CtypeMap[uint8(**(**uint8)(__ccgo_up(zDate + 1)))])&int32(0x04) != 0 { rScale = float64(1) zDate = zDate + 1 for libc.Int32FromUint8(_sqlite3CtypeMap[uint8(**(**uint8)(__ccgo_up(zDate)))])&int32(0x04) != 0 { ms = float64(ms*float64(10)) + float64(**(**uint8)(__ccgo_up(zDate))) - libc.Float64FromUint8('0') rScale = rScale * float64(10) zDate = zDate + 1 } ms = ms / rScale /* Truncate to avoid problems with sub-milliseconds ** rounding. https://sqlite.org/forum/forumpost/766a2c9231 */ if ms > float64(0.999) { ms = float64(0.999) } } } else { **(**int32)(__ccgo_up(bp + 8)) = 0 } (*TDateTime)(unsafe.Pointer(p)).FvalidJD = uint8(0) libc.SetBitFieldPtr8Uint32(p+44, libc.Uint32FromInt32(0), 0, 0x1) (*TDateTime)(unsafe.Pointer(p)).FvalidHMS = uint8(1) (*TDateTime)(unsafe.Pointer(p)).Fh = **(**int32)(__ccgo_up(bp)) (*TDateTime)(unsafe.Pointer(p)).Fm = **(**int32)(__ccgo_up(bp + 4)) (*TDateTime)(unsafe.Pointer(p)).Fs = float64(**(**int32)(__ccgo_up(bp + 8))) + ms if _parseTimezone(tls, zDate, p) != 0 { return int32(1) } return 0 } // C documentation // // /* // ** Parse a timezone extension on the end of a date-time. // ** The extension is of the form: // ** // ** (+/-)HH:MM // ** // ** Or the "zulu" notation: // ** // ** Z // ** // ** If the parse is successful, write the number of minutes // ** of change in p->tz and return 0. If a parser error occurs, // ** return non-zero. // ** // ** A missing specifier is not considered an error. // */ func _parseTimezone(tls *libc.TLS, zDate uintptr, p uintptr) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var c, sgn int32 var _ /* nHr at bp+0 */ int32 var _ /* nMn at bp+4 */ int32 _, _ = c, sgn sgn = 0 for libc.Int32FromUint8(_sqlite3CtypeMap[uint8(**(**uint8)(__ccgo_up(zDate)))])&int32(0x01) != 0 { zDate = zDate + 1 } (*TDateTime)(unsafe.Pointer(p)).Ftz = 0 c = libc.Int32FromUint8(**(**uint8)(__ccgo_up(zDate))) if c == int32('-') { sgn = -int32(1) } else { if c == int32('+') { sgn = +libc.Int32FromInt32(1) } else { if c == int32('Z') || c == int32('z') { zDate = zDate + 1 libc.SetBitFieldPtr8Uint32(p+44, libc.Uint32FromInt32(0), 4, 0x10) libc.SetBitFieldPtr8Uint32(p+44, libc.Uint32FromInt32(1), 3, 0x8) goto zulu_time } else { return libc.BoolInt32(c != 0) } } } zDate = zDate + 1 if _getDigits(tls, zDate, __ccgo_ts+1196, libc.VaList(bp+16, bp, bp+4)) != int32(2) { return int32(1) } zDate = zDate + uintptr(5) (*TDateTime)(unsafe.Pointer(p)).Ftz = sgn * (**(**int32)(__ccgo_up(bp + 4)) + **(**int32)(__ccgo_up(bp))*int32(60)) if (*TDateTime)(unsafe.Pointer(p)).Ftz == 0 { /* Forum post 2025-09-17T10:12:14z */ libc.SetBitFieldPtr8Uint32(p+44, libc.Uint32FromInt32(0), 4, 0x10) libc.SetBitFieldPtr8Uint32(p+44, libc.Uint32FromInt32(1), 3, 0x8) } goto zulu_time zulu_time: ; for libc.Int32FromUint8(_sqlite3CtypeMap[uint8(**(**uint8)(__ccgo_up(zDate)))])&int32(0x01) != 0 { zDate = zDate + 1 } return libc.BoolInt32(libc.Int32FromUint8(**(**uint8)(__ccgo_up(zDate))) != 0) }