summaryrefslogtreecommitdiffstats
path: root/src/H5timer.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2006-11-28 17:43:54 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2006-11-28 17:43:54 (GMT)
commit0bd83631d5ed24fe948a273e8a4d4bd8f128a86c (patch)
treec950f5b5b4e81aa8f45f0ece90cc463e832bb2e0 /src/H5timer.c
parent4ef5853e2d4235e57cfe7e6ce0fcb1b9359f8966 (diff)
downloadhdf5-0bd83631d5ed24fe948a273e8a4d4bd8f128a86c.zip
hdf5-0bd83631d5ed24fe948a273e8a4d4bd8f128a86c.tar.gz
hdf5-0bd83631d5ed24fe948a273e8a4d4bd8f128a86c.tar.bz2
[svn-r12990] Description:
When using the latest version of the file format, move the "modification time" information into the object header prefix, which is more efficient. Also add "access time" and "change time" (for metadata) fields, all of which take about the same space as the previous modification time header message. Tested on: Linux/32 2.6 (chicago) Linux/64 2.6 (chicago2)
Diffstat (limited to 'src/H5timer.c')
-rw-r--r--src/H5timer.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/H5timer.c b/src/H5timer.c
index 128c03f..cbbef3f 100644
--- a/src/H5timer.c
+++ b/src/H5timer.c
@@ -38,6 +38,10 @@
# include <sys/resource.h>
#endif
+#ifdef H5_HAVE_GETTIMEOFDAY
+#include <sys/time.h>
+#endif /* H5_HAVE_GETTIMEOFDAY */
+
/****************/
/* Local Macros */
@@ -246,3 +250,35 @@ H5_bandwidth(char *buf/*out*/, double nbytes, double nseconds)
}
} /* end H5_bandwidth() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5_now
+ *
+ * Purpose: Retrieves the current time, as seconds after the UNIX epoch.
+ *
+ * Return: # of seconds from the epoch (can't fail)
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, November 28, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+time_t
+H5_now(void)
+{
+ time_t now; /* Current time */
+
+#ifdef H5_HAVE_GETTIMEOFDAY
+ {
+ struct timeval now_tv;
+
+ HDgettimeofday(&now_tv, NULL);
+ now = now_tv.tv_sec;
+ }
+#else /* H5_HAVE_GETTIMEOFDAY */
+ now = HDtime(NULL);
+#endif /* H5_HAVE_GETTIMEOFDAY */
+
+ return(now);
+} /* end H5_now() */
+