diff options
author | phk <phk@FreeBSD.org> | 2006-10-22 18:19:08 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2006-10-22 18:19:08 +0000 |
commit | cc74fcabb418a714919dc9abc75e57e47b0a058c (patch) | |
tree | 0f4a309eda4fb9acf94037357f9d13df379af6c7 /contrib | |
parent | fd37d7b5f59af1c144d0f330db55024c9a282adf (diff) | |
download | FreeBSD-src-cc74fcabb418a714919dc9abc75e57e47b0a058c.zip FreeBSD-src-cc74fcabb418a714919dc9abc75e57e47b0a058c.tar.gz |
Add two new functions to convert FAT filesystem format timestamps
to and from struct timespec, to replace the crummy conversion
function which have been copy&pasted into three different
filesystems already.
Apart from general crummyness as indicated by code like:
for (year = 1970;; year++) {
inc = year & 0x03 ? 365 : 366;
if (days < inc)
break;
days -= inc;
}
They also contain specialized crummyness which tries to compensate
for the general crummyness by caching recent conversion results,
with no regard for locking or consistency.
These replacement functions are smaller, O(1) and handle the Y2.1K
leap-year correctly.
Ideally, these functions should live in a module of their own,
which the three offending filesystems would depend on, but the
size is 877 bytes of code (on i386), so that would be false
economy.
Diffstat (limited to 'contrib')
0 files changed, 0 insertions, 0 deletions