SRFI-19 padding error

Issue #273 resolved
Alex Kicelew created an issue

SRFI-19 defines ~k converter of date->string as blank-padded variant of ~H, but sagittarius treats it as ~H and pads with zero.

(import (scheme base)
        (scheme write)
        (srfi 19))

(let* ((d (make-date 0 1 2 3 4 5 2006 0)))
  (display (date->string d "~a ~b ~e ~k:~M:~S ~Y"))
  (newline))

expected: Thu May 4 3:02:01 2006

got: Thu May 4 03:02:01 2006

Comments (5)

  1. Alex Kicelew reporter

    Thank you. I would add the following information. If I understand right, SRFi-19’s date->string and string->date are modeled after very old UNIX' strftime (format time) and strptime (parse time) functions, which both accept the same format identifiers as SRFI-19, only with % instead of ~. And strptime always formats %k and %l as blank-padded digits if they’re less than 10, and %H and %I as zero-padded.

  2. Log in to comment