Thu 22 Oct 2015 07:50:18 PM UTC, comment #10:
no problem. Sure, stick my name on the list.
sorry for the extra work in formatting. I sort of knew it was lacking in that regard, just didn't get back to it to finish fixing. thanks for closing the loop.
|
Thu 22 Oct 2015 06:04:29 PM UTC, comment #9:
Wow, thanks for both the discovery and solution to this problem. I converted your patch to core Octave coding style. For example, We use a space between a function name and the parenthesis that marks the start of the argument list. The space is not used if you are doing indexing on a vector or matrix. This makes it simple to tell the two situations apart. The list of all our coding conventions is in one of the appendices of the Octave manual if you start generating more patches. Do you wish to be listed as a contributor to OCtave in the front of the manual? We like to acknowledge everyone who has helped, but some people prefer to remain anonymous.
The completed changeset was made on the stable branch (http://hg.savannah.gnu.org/hgweb/octave/rev/1a02e15a9f4c) and will be part of the 4.0.1 bug fix release.
|
Tue 13 Oct 2015 01:33:13 PM UTC, comment #8:
verified that FFF behavior matches output with Matlab 2015a. (handles fewer than 3 digits whether at the end of the file or not)
believe the revised function should be good to go.
|
Mon 12 Oct 2015 02:26:02 AM UTC, comment #7:
forgot to mod header
(file #35161)
|
Mon 12 Oct 2015 02:22:19 AM UTC, comment #6:
a few more edits needed than I had anticipated to pass all the tests after my changes broke a couple. passes all tests now, and I added a few more to catch FFF, AM/PM, and variable number of FFF digits.
I haven't been able to compare the tests to expected Matlab output, someone should make sure there's nothing in the tests that shouldn't be there, or maybe add a couple extra.
Revised file appended to this comment.
(file #35160)
|
Sun 11 Oct 2015 12:56:01 PM UTC, comment #5:
ok, replacing the lines 254-263 if block with:
makes things work for having both FFF and am/pm. I left the commented out lines in the inner if block for reference. also, note that it will only work for 3 digits given for the FFF part. If less than three digits is given for FFF, it will grab extra trailing characters. previous code assumed the FFF data was either 3 digits or at the end of the string. not sure of the best way to cover that. if there's an easy way to have it grab up to the first non-numeric or whitespace, then the line I threw into Comment 2 could take care of it for numel(msec)<3
|
Sun 11 Oct 2015 12:30:47 PM UTC, comment #4:
correction. that line works, but the line 258 if block to get tm.usec breaks. maybe a kludge for the kludge...
|
Sun 11 Oct 2015 03:39:21 AM UTC, comment #3:
appears that at line 257 strptime fails to match ds to format f, so returns nc=0. this makes it skips over the 'msec' kludge and the next loop as well, then return false for found, which calls the error.
it appears that when the .FFF is stripped out of the format string, the . is left. if the fractional seconds are added as a string to format, as is done in the line 258 if block, then things work.
|
Sun 11 Oct 2015 03:02:43 AM UTC, comment #2:
starting to step through datevec.m, stumbled onto the fact that inside the kludge it doesn't distinguish between .2 .02 and .002. all three give the output of .002
i don't know if it should error out if FFF is given but less than three digits are there. I can see where some programs or systems might drop trailing zeros.
If we need to throw an error for ML compatibility, that should be easy enough by checking numel(msec)<3.
If it needs to function, inserting the following line before 262 fixes the problem:
|
Sat 10 Oct 2015 01:38:08 PM UTC, comment #1:
peeking at datevec.m, I see on line 255:
haven't stepped through it all yet, but my guess is the kludge is missing a piece... :)
|
Sat 10 Oct 2015 01:36:06 PM UTC, original submission:
Was attempting to troubleshoot some code using datenum. it was failing on trying to read a particular datestring that had both fractional seconds and the PM designation. if I remove either, it works fine. Example:
Note: don't have ML access right now to verify expected/compatible ML behavior.
(a side point: should datevec fail (for compatibility) if the month and day are not zero padded? From the help I thought it should, but it does not?)
|