[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#642955: general: strptime pars not week number



Package: general
Severity: normal

strptime pars 2001 and week number 38 use formatstring "%Y %W"
strptime return 0 day on year 2001
I to adapt code example from man strptime.

libc6 2.11.2-10
gcc 4.4.5-8



-- System Information:
Debian Release: 6.0.2
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/2 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
#define _XOPEN_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

int
main(void)
{
   struct tm tm;
   char buf[255];

   memset(&tm, 0, sizeof(struct tm));
   strptime("2001 38", "%Y %W", &tm);
   strftime(buf, sizeof(buf), "%d %b %Y %H:%M %W", &tm);
   puts(buf);
   exit(EXIT_SUCCESS);
}

Reply to: