* Added real_time_clock(), and real_time_clock_usecs().
* Added support for timespec stat times. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31012 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
0d85a0853c
commit
4ab3fa3b5a
@ -1221,6 +1221,10 @@
|
||||
#define st_size fssh_st_size
|
||||
#define st_rdev fssh_st_rdev
|
||||
#define st_blksize fssh_st_blksize
|
||||
#define st_atim fssh_st_atim
|
||||
#define st_mtim fssh_st_mtim
|
||||
#define st_ctim fssh_st_ctim
|
||||
#define st_crtim fssh_st_crtim
|
||||
#define st_atime fssh_st_atime
|
||||
#define st_mtime fssh_st_mtime
|
||||
#define st_ctime fssh_st_ctime
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008, Haiku Inc. All Rights Reserved.
|
||||
* Copyright 2002-2009, Haiku Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _FSSH_SYS_STAT_H_
|
||||
@ -20,10 +20,10 @@ struct fssh_stat {
|
||||
fssh_off_t fssh_st_size; /* size in bytes of this file */
|
||||
fssh_dev_t fssh_st_rdev; /* device type (not used) */
|
||||
fssh_size_t fssh_st_blksize; /* preferred block size for i/o */
|
||||
fssh_time_t fssh_st_atime; /* last access time */
|
||||
fssh_time_t fssh_st_mtime; /* last modification time */
|
||||
fssh_time_t fssh_st_ctime; /* last change time, not creation time */
|
||||
fssh_time_t fssh_st_crtime; /* creation time */
|
||||
fssh_timespec fssh_st_atim; /* last access time */
|
||||
fssh_timespec fssh_st_mtim; /* last modification time */
|
||||
fssh_timespec fssh_st_ctim; /* last change time, not creation time */
|
||||
fssh_timespec fssh_st_crtim; /* creation time */
|
||||
|
||||
// Haiku extensions:
|
||||
// TODO: we might also define special types for files and TTYs
|
||||
@ -34,6 +34,12 @@ struct fssh_stat {
|
||||
};
|
||||
typedef struct fssh_stat fssh_struct_stat;
|
||||
|
||||
/* compatibility with older apps */
|
||||
#define fssh_st_atime fssh_st_atim.tv_sec
|
||||
#define fssh_st_mtime fssh_st_mtim.tv_sec
|
||||
#define fssh_st_ctime fssh_st_ctim.tv_sec
|
||||
#define fssh_st_crtime fssh_st_crtim.tv_sec
|
||||
|
||||
/* extended file types */
|
||||
#define FSSH_S_ATTR_DIR 01000000000 /* attribute directory */
|
||||
#define FSSH_S_ATTR 02000000000 /* attribute */
|
||||
|
@ -1,5 +1,7 @@
|
||||
/*
|
||||
* Copyright 2009, Axel Dörfler, axeld@pinc-software.de.
|
||||
* Copyright 2007, Ingo Weinhold, bonefish@cs.tu-berlin.de.
|
||||
*
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
@ -9,6 +11,7 @@
|
||||
#include "fssh_time.h"
|
||||
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <OS.h>
|
||||
|
||||
@ -17,24 +20,12 @@
|
||||
|
||||
#if 0
|
||||
|
||||
uint32_t
|
||||
fssh_real_time_clock(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
fssh_set_real_time_clock(uint32_t secs_since_jan1_1970)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
fssh_bigtime_t
|
||||
fssh_real_time_clock_usecs(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
fssh_status_t
|
||||
fssh_set_timezone(char *timezone)
|
||||
{
|
||||
@ -42,6 +33,26 @@ fssh_set_timezone(char *timezone)
|
||||
|
||||
#endif // 0
|
||||
|
||||
uint32_t
|
||||
fssh_real_time_clock(void)
|
||||
{
|
||||
timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
|
||||
return tv.tv_sec;
|
||||
}
|
||||
|
||||
|
||||
fssh_bigtime_t
|
||||
fssh_real_time_clock_usecs(void)
|
||||
{
|
||||
timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
|
||||
return tv.tv_sec * 1000000LL + tv.tv_usec;
|
||||
}
|
||||
|
||||
|
||||
fssh_bigtime_t
|
||||
fssh_system_time(void)
|
||||
{
|
||||
|
@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2008, Axel Dörfler, axeld@pinc-software.de.
|
||||
* Copyright 2002-2009, Axel Dörfler, axeld@pinc-software.de.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
|
||||
* Distributed under the terms of the NewOS License.
|
||||
*/
|
||||
|
||||
/* Virtual File System and File System Interface Layer */
|
||||
/*! Virtual File System and File System Interface Layer */
|
||||
|
||||
#include "vfs.h"
|
||||
|
||||
@ -3828,6 +3828,11 @@ common_read_stat(struct file_descriptor *descriptor, struct fssh_stat *stat)
|
||||
|
||||
FUNCTION(("common_read_stat: stat %p\n", stat));
|
||||
|
||||
stat->fssh_st_atim.tv_nsec = 0;
|
||||
stat->fssh_st_mtim.tv_nsec = 0;
|
||||
stat->fssh_st_ctim.tv_nsec = 0;
|
||||
stat->fssh_st_crtim.tv_nsec = 0;
|
||||
|
||||
fssh_status_t status = FS_CALL(vnode, read_stat, stat);
|
||||
|
||||
// fill in the st_dev and st_ino fields
|
||||
|
Loading…
Reference in New Issue
Block a user