octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #51340] datevec jump hour on 29/03/2009 02:*


From: Juan Pablo Carbajal
Subject: [Octave-bug-tracker] [bug #51340] datevec jump hour on 29/03/2009 02:*
Date: Thu, 29 Jun 2017 03:57:31 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.109 Safari/537.36

URL:
  <http://savannah.gnu.org/bugs/?51340>

                 Summary: datevec jump hour on 29/03/2009 02:*
                 Project: GNU Octave
            Submitted by: juanpi
            Submitted on: Thu 29 Jun 2017 07:57:29 AM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: juanpi
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: GNU/Linux

    _______________________________________________________

Details:

Hi,

datevec adds one hour to dates on 29/03/2009 02:*

I chased this bug down to datevec (actually I think the bug is in
octave::sys::strptime)


vec        = repmat ([2009 3 29 2 0 0],6,1);
vec(:,5:6) = randi(59,6,2);  # random minutes and seconds
fmt        = 'dd/mm/yyyy HH:MM:SS';
vstr       = datestr (vec, fmt);
vec_       = datevec (vstr, fmt);
assert (vec_, vec_);


I checked that the bug is not in my system's strptime. The following program
outputs the right values


#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("2009-03-29 14:00:00", "%Y-%m-%d %H:%M:%S", &tm);
   //strptime("2009-03-29 02:00:00", "%Y-%m-%d %H:%M:%S", &tm);
   strptime("29/03/2009 02:00:00", "%d/%m/%Y %H:%M:%S", &tm);
   strftime(buf, sizeof(buf), "%d %b %Y %H:%M", &tm);
   puts(buf);
   exit(EXIT_SUCCESS);
}





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?51340>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]