<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - std::get_time incorrectly parses string produced by std::put_time"
href="https://bugs.llvm.org/show_bug.cgi?id=36232">36232</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>std::get_time incorrectly parses string produced by std::put_time
</td>
</tr>
<tr>
<th>Product</th>
<td>libc++
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Macintosh
</td>
</tr>
<tr>
<th>OS</th>
<td>MacOS X
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>dkstrickland2@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=19810" name="attach_19810" title="c++ to reproduce std::get_time problem">attachment 19810</a> <a href="attachment.cgi?id=19810&action=edit" title="c++ to reproduce std::get_time problem">[details]</a></span>
c++ to reproduce std::get_time problem
std::get_time fails to correctly parse a date/time string produced by
std::put_time using the same format.
See the following output. In the last format used (which is equivalent to the
linux/OSX 'date' command), get_time does not get the year correct, so it
appears as 0 (i.e. 1900). I'm less concerned about the first two cases where
the input/output std::tm structs are not identical as long as the initial and
final string representations are equivalent.
azathoth Clang 12:55:52$ ./GetTimeTest
Testing format: %F %T
Result of put_time on tm1: 2008-01-02 12:23:45
WARN: Struct from get_time, tm2!=tm1. Possible BUG?.
Result of put_time on tm2: 2008-01-02 12:23:45
OK: String repr of get_time tm2 == string repr of tm1.
Testing format: %Y-%m-%d %H:%M:%S
Result of put_time on tm1: 2008-01-02 12:23:45
WARN: Struct from get_time, tm2!=tm1. Possible BUG?.
Result of put_time on tm2: 2008-01-02 12:23:45
OK: String repr of get_time tm2 == string repr of tm1.
Testing format: %a %b %e %T %Z %Y
Result of put_time on tm1: Wed Jan 2 12:23:45 EST 2008
WARN: Struct from get_time, tm2!=tm1. Possible BUG?.
Result of put_time on tm2: Wed Jan 2 12:23:45 EST 1900
ERROR: String repr of get_time tm2 != string repr of tm1. PROBLEM.
Code to reproduce problem is attached. I'm running this on OSX El Capitan,
using the xcode provided version of clang and libc++:
otool -L GetTimeTest
GetTimeTest:
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version
120.1.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 1226.10.1)
pkgutil --file-info /usr/lib/libc++.1.dylib
volume: /
path: /usr/lib/libc++.1.dylib
pkgid: com.apple.pkg.Essentials
pkg-version: 10.11.6.1.1.1502239837
install-time: 1515023711
uid: 0
gid: 0
mode: 755
c++ -v
Apple LLVM version 8.0.0 (clang-800.0.42.1)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>