[Haiku-commits] r31012 - in haiku/trunk: headers/private/fs_shell src/tools/fs_shell
axeld at BerliOS
axeld at mail.berlios.de
Fri Jun 12 11:31:27 CEST 2009
Author: axeld
Date: 2009-06-12 11:31:25 +0200 (Fri, 12 Jun 2009)
New Revision: 31012
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=31012&view=rev
Modified:
haiku/trunk/headers/private/fs_shell/fssh_api_wrapper.h
haiku/trunk/headers/private/fs_shell/fssh_stat.h
haiku/trunk/src/tools/fs_shell/time.cpp
haiku/trunk/src/tools/fs_shell/vfs.cpp
Log:
* Added real_time_clock(), and real_time_clock_usecs().
* Added support for timespec stat times.
Modified: haiku/trunk/headers/private/fs_shell/fssh_api_wrapper.h
===================================================================
--- haiku/trunk/headers/private/fs_shell/fssh_api_wrapper.h 2009-06-12 09:09:20 UTC (rev 31011)
+++ haiku/trunk/headers/private/fs_shell/fssh_api_wrapper.h 2009-06-12 09:31:25 UTC (rev 31012)
@@ -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
Modified: haiku/trunk/headers/private/fs_shell/fssh_stat.h
===================================================================
--- haiku/trunk/headers/private/fs_shell/fssh_stat.h 2009-06-12 09:09:20 UTC (rev 31011)
+++ haiku/trunk/headers/private/fs_shell/fssh_stat.h 2009-06-12 09:31:25 UTC (rev 31012)
@@ -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 @@
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 @@
};
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 */
Modified: haiku/trunk/src/tools/fs_shell/time.cpp
===================================================================
--- haiku/trunk/src/tools/fs_shell/time.cpp 2009-06-12 09:09:20 UTC (rev 31011)
+++ haiku/trunk/src/tools/fs_shell/time.cpp 2009-06-12 09:31:25 UTC (rev 31012)
@@ -1,5 +1,7 @@
/*
+ * Copyright 2009, Axel Dörfler, axeld at pinc-software.de.
* Copyright 2007, Ingo Weinhold, bonefish at 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,30 +20,38 @@
#if 0
-uint32_t
-fssh_real_time_clock(void)
+void
+fssh_set_real_time_clock(uint32_t secs_since_jan1_1970)
{
}
-void
-fssh_set_real_time_clock(uint32_t secs_since_jan1_1970)
+fssh_status_t
+fssh_set_timezone(char *timezone)
{
}
+#endif // 0
-fssh_bigtime_t
-fssh_real_time_clock_usecs(void)
+uint32_t
+fssh_real_time_clock(void)
{
+ timeval tv;
+ gettimeofday(&tv, NULL);
+
+ return tv.tv_sec;
}
-fssh_status_t
-fssh_set_timezone(char *timezone)
+fssh_bigtime_t
+fssh_real_time_clock_usecs(void)
{
+ timeval tv;
+ gettimeofday(&tv, NULL);
+
+ return tv.tv_sec * 1000000LL + tv.tv_usec;
}
-#endif // 0
fssh_bigtime_t
fssh_system_time(void)
Modified: haiku/trunk/src/tools/fs_shell/vfs.cpp
===================================================================
--- haiku/trunk/src/tools/fs_shell/vfs.cpp 2009-06-12 09:09:20 UTC (rev 31011)
+++ haiku/trunk/src/tools/fs_shell/vfs.cpp 2009-06-12 09:31:25 UTC (rev 31012)
@@ -1,12 +1,12 @@
/*
- * Copyright 2002-2008, Axel Dörfler, axeld at pinc-software.de.
+ * Copyright 2002-2009, Axel Dörfler, axeld at 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 @@
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
More information about the Haiku-commits
mailing list