* renamed bfs_inode::ToUsecs() to bfs_inode::ToNsecs, as it really converts to nanoseconds.
* added a comment explaining the nanoseconds conversion git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38965 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -121,13 +121,13 @@ dump_inode(const bfs_inode* inode)
|
||||
kprintf(" flags = %08x\n", (int)inode->Flags());
|
||||
kprintf(" create_time = %" B_PRIx64 " (%" B_PRIdTIME ".%u)\n",
|
||||
inode->CreateTime(), bfs_inode::ToSecs(inode->CreateTime()),
|
||||
(unsigned)bfs_inode::ToUsecs(inode->CreateTime()));
|
||||
(unsigned)bfs_inode::ToNsecs(inode->CreateTime()));
|
||||
kprintf(" last_modified_time = %" B_PRIx64 " (%" B_PRIdTIME ".%u)\n",
|
||||
inode->LastModifiedTime(), bfs_inode::ToSecs(inode->LastModifiedTime()),
|
||||
(unsigned)bfs_inode::ToUsecs(inode->LastModifiedTime()));
|
||||
(unsigned)bfs_inode::ToNsecs(inode->LastModifiedTime()));
|
||||
kprintf(" status_change_time = %" B_PRIx64 " (%" B_PRIdTIME ".%u)\n",
|
||||
inode->StatusChangeTime(), bfs_inode::ToSecs(inode->StatusChangeTime()),
|
||||
(unsigned)bfs_inode::ToUsecs(inode->StatusChangeTime()));
|
||||
(unsigned)bfs_inode::ToNsecs(inode->StatusChangeTime()));
|
||||
dump_block_run( " parent = ", inode->parent);
|
||||
dump_block_run( " attributes = ", inode->attributes);
|
||||
kprintf(" type = %u\n", (unsigned)inode->Type());
|
||||
|
||||
@@ -238,10 +238,12 @@ struct bfs_inode {
|
||||
{ return ((int64)tv.tv_sec << INODE_TIME_SHIFT)
|
||||
+ unique_from_nsec(tv.tv_nsec); }
|
||||
|
||||
static time_t ToSecs(bigtime_t time)
|
||||
static time_t ToSecs(int64 time)
|
||||
{ return time >> INODE_TIME_SHIFT; }
|
||||
static uint32 ToUsecs(bigtime_t time)
|
||||
static uint32 ToNsecs(int64 time)
|
||||
{ return (time & INODE_TIME_MASK) << 14; }
|
||||
// the 16 bits internal resolution shifted by 14 gives us 2^30
|
||||
// which is roughly 10^9, the maximum value in nanoseconds
|
||||
} _PACKED;
|
||||
|
||||
enum inode_flags {
|
||||
|
||||
@@ -35,13 +35,14 @@ extern void fill_stat_buffer(Inode* inode, struct stat& stat);
|
||||
static void
|
||||
fill_stat_time(const bfs_inode& node, struct stat& stat)
|
||||
{
|
||||
stat.st_atim.tv_sec = real_time_clock();
|
||||
stat.st_atim.tv_nsec = real_time_clock_usecs() % 1000000;
|
||||
bigtime_t now = real_time_clock_usecs();
|
||||
stat.st_atim.tv_sec = now / 1000000LL;
|
||||
stat.st_atim.tv_nsec = (now % 1000000LL) * 1000;
|
||||
|
||||
stat.st_mtim.tv_sec = bfs_inode::ToSecs(node.LastModifiedTime());
|
||||
stat.st_mtim.tv_nsec = bfs_inode::ToUsecs(node.LastModifiedTime());
|
||||
stat.st_mtim.tv_nsec = bfs_inode::ToNsecs(node.LastModifiedTime());
|
||||
stat.st_crtim.tv_sec = bfs_inode::ToSecs(node.CreateTime());
|
||||
stat.st_crtim.tv_nsec = bfs_inode::ToUsecs(node.CreateTime());
|
||||
stat.st_crtim.tv_nsec = bfs_inode::ToNsecs(node.CreateTime());
|
||||
|
||||
// For BeOS compatibility, if on-disk ctime is invalid, fall back to mtime:
|
||||
bigtime_t changeTime = node.StatusChangeTime();
|
||||
@@ -49,7 +50,7 @@ fill_stat_time(const bfs_inode& node, struct stat& stat)
|
||||
stat.st_ctim = stat.st_mtim;
|
||||
else {
|
||||
stat.st_ctim.tv_sec = bfs_inode::ToSecs(changeTime);
|
||||
stat.st_ctim.tv_nsec = bfs_inode::ToUsecs(changeTime);
|
||||
stat.st_ctim.tv_nsec = bfs_inode::ToNsecs(changeTime);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user