Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

strptime parsing of %W and %w broken #55

Open
stoecker opened this issue Nov 25, 2021 · 0 comments
Open

strptime parsing of %W and %w broken #55

stoecker opened this issue Nov 25, 2021 · 0 comments

Comments

@stoecker
Copy link

stoecker commented Nov 25, 2021

perl -e 'use Time::Piece; print Time::Piece->strptime("2021 47 1","%Y %W %w");'
should output 2021-11-22, but outputs 2021-01-01

using the same with C

#define _XOPEN_SOURCE
#include <stdio.h>
#include <time.h>

int main(void)
{
  struct tm t;
  printf("%s\n", strptime("2021 47 1", "%Y %W %w", &t));
  
  printf("%d-%02d-%02d\n", 1900+t.tm_year, t.tm_mon+1, t.tm_mday);
}

outputs 2021-11-22

It seems the _strptime in Piece.xs is improperly implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant