diff --git a/airframe-log/.native/src/main/scala/wvlet/log/LogTimestampFormatter.scala b/airframe-log/.native/src/main/scala/wvlet/log/LogTimestampFormatter.scala index 7b7904a920..0951abe200 100644 --- a/airframe-log/.native/src/main/scala/wvlet/log/LogTimestampFormatter.scala +++ b/airframe-log/.native/src/main/scala/wvlet/log/LogTimestampFormatter.scala @@ -30,7 +30,7 @@ object LogTimestampFormatter { !ttPtr = (timeMillis / 1000).toSize val tmPtr = alloc[tm]() localtime_r(ttPtr, tmPtr) - val bufSize = 26.toUSize + val bufSize = 29.toUSize // max size for time strings val buf: Ptr[Byte] = alloc[Byte](bufSize) strftime(buf, bufSize, pattern, tmPtr) val ms = timeMillis % 1000 @@ -41,7 +41,12 @@ object LogTimestampFormatter { val tzBuf: Ptr[Byte] = alloc[Byte](5) strftime(tzBuf, 5.toUSize, c"%z", tmPtr) - strcat(buf, tzBuf) + if (strlen(tzBuf) <= 1.toUSize) { + // For UTC-00:00 + strcat(buf, c"Z") + } else { + strcat(buf, tzBuf) + } fromCString(buf) } }