<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Apr 16, 2017 at 1:28 PM, Rob Landley <span dir="ltr"><<a href="mailto:rob@landley.net" target="_blank">rob@landley.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-">On 04/15/2017 01:17 PM, enh wrote:<br>
><br>
> Used by the toybox touch test suite (and thus necessary to pass the toybox<br>
> tests on a toybox-only system).<br>
<br>
</span>Did I ever actually post my rant on this topic? Or just compose it and<br>
save as draft.<br>
<br>
This is really really libc's job, it's a pity the gnu guys didn't<br>
coordinate with the glibc developers. (On the other hand, I suppose<br>
that's why glibc wasn't worse.)<br></blockquote><div><br></div><div>yeah, definitely a mess.</div><div><br></div><div>note that i only did this because (a) existing tests were using it and (b) busybox has it too. i've been assuming (perhaps incorrectly) that busybox also tried to avoid needlessly implementing GNU extensions unless they were actually useful to enough people.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Yes "struct tm" doesn't have nanoseconds, and they don't want to make it<br>
bigger because binary compatibility. But lp64 says int is 32 bits, so<br>
they could stick the nanoseconds in the middle 30 bits of tm_isdst (old<br>
0 and 1 inputs only flip the bottom bit, -1 sets the top bit, middle 30<br>
bits are basically unused and can store 0-999999999; old code that sets<br>
the field to -1 means nanoseconds are over 999999999 and you can treat<br>
that as 0). Then strptime and strftime could both have access to<br>
nanoseconds and could both implement %N. It's a little awkward but more<br>
or less backwards compatible.<br>
<br>
I already have date.c accepting nanoseconds input in its<br>
@unixtime.fraction format. I pondered doing it for the<br>
MMDDhhmm[[CC]YY][.ss] one but it doesn't OUTPUT that format which is<br>
just sad. (Be symmetrical, people!) I've pondered _adding_ a flag to<br>
make date output that, but "toybox tests require toybox commands" is a<br>
bridge I haven't crossed yet.<br>
<br>
Speaking of which, this patch adds %N to output but not to input, so<br>
date can still only _set_ nanoseconds using the @123456789.123456789<br>
syntax.</blockquote><div><br></div><div>isn't setting via arbitrary format a toybox extension? </div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> And you're not checking that "%%N is a literal %N". (Sigh. If<br>
we're going there, may I draw your attention to next_printf() in<br>
lib/lib.c? Example usage in seq and stat.)<br></blockquote><div><br></div><div>okay, i'll switch it over (assuming we actually want %N).</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
It's kind of sad "ls" can't show nanoseconds. Or "stat". I understand<br>
why (nanoseconds were added when makefile dependencies started breaking<br>
as computers got faster and multiple build things happened in the same<br>
second; nothing else actually _needed_ them in the filesystem) but it's<br>
still half-assed.<br></blockquote><div><br></div><div><div>~$ ls -ld --time-style=full-iso /</div><div>drwxr-xr-x 25 root root 4096 2017-04-10 08:08:16.298419414 -0700 /</div><div>~$ stat /</div><div> File: ‘/’</div><div> Size: 4096 <span class="gmail-Apple-tab-span" style="white-space:pre"> </span>Blocks: 8 IO Block: 4096 directory</div><div>Device: fc01h/64513d<span class="gmail-Apple-tab-span" style="white-space:pre"> </span>Inode: 2 Links: 25</div><div>Access: (0755/drwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)</div><div>Access: 2017-04-16 13:35:50.436148625 -0700</div><div>Modify: 2017-04-10 08:08:16.298419414 -0700</div><div>Change: 2017-04-10 08:08:16.298419414 -0700</div><div> Birth: -</div><div>~$ </div></div><div><br></div><div>i'm happy to rewrite the tests instead... i've never used %N personally, and would just naturally use stat for this kind of thing.</div><div><br></div><div>as you say, the asymmetry is ugly, and the divergence from libc is ugly, so if busybox added this "just because" maybe we shouldn't have it at all?</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Grumble grumble...<br>
<span class="gmail-HOEnZb"><font color="#888888"><br>
Rob<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Elliott Hughes - <a href="http://who/enh" target="_blank">http://who/enh</a> - <a href="http://jessies.org/~enh/" target="_blank">http://jessies.org/~enh/</a><br>Android native code/tools questions? Mail me/drop by/add me as a reviewer.</div>
</div></div>