|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r79780 - trunk/tools/build/v2/engine
From: jurko.gospodnetic_at_[hidden]
Date: 2012-07-28 05:20:30
Author: jurko
Date: 2012-07-28 05:20:29 EDT (Sat, 28 Jul 2012)
New Revision: 79780
URL: http://svn.boost.org/trac/boost/changeset/79780
Log:
Updated Boost Jam to know how to report its minimum supported file modification timestamp resolution (currently reported as part of Boost Jam's version information). This allows external tools using Boost Jam to adapt to Boost Jam's potential ignorance of fine file modification timestamp changes.
For example, Boost Build's internal testing framework may use this information to reduce the time it spends doing nothing by sleeping until enough time passes to make newly created or touched files be correctly recognized by Boost Build.
Text files modified:
trunk/tools/build/v2/engine/filent.c | 27 +++++++++++++++++++++++++--
trunk/tools/build/v2/engine/filesys.h | 1 +
trunk/tools/build/v2/engine/fileunix.c | 27 +++++++++++++++++++++++++--
trunk/tools/build/v2/engine/jam.c | 6 ++++++
trunk/tools/build/v2/engine/timestamp.c | 25 +++++++++++++++++++------
trunk/tools/build/v2/engine/timestamp.h | 1 +
6 files changed, 77 insertions(+), 10 deletions(-)
Modified: trunk/tools/build/v2/engine/filent.c
==============================================================================
--- trunk/tools/build/v2/engine/filent.c (original)
+++ trunk/tools/build/v2/engine/filent.c 2012-07-28 05:20:29 EDT (Sat, 28 Jul 2012)
@@ -15,8 +15,9 @@
* filent.c - scan directories and archives on NT
*
* External routines:
- * file_archscan() - scan an archive for files
- * file_mkdir() - create a directory
+ * file_archscan() - scan an archive for files
+ * file_mkdir() - create a directory
+ * file_supported_fmt_resolution() - file modification timestamp resolution
*
* External routines called only via routines in filesys.c:
* file_collect_dir_content_() - collects directory content information
@@ -206,6 +207,28 @@
/*
+ * file_supported_fmt_resolution() - file modification timestamp resolution
+ *
+ * Returns the minimum file modification timestamp resolution supported by this
+ * Boost Jam implementation. File modification timestamp changes of less than
+ * the returned value might not be recognized.
+ *
+ * Does not take into consideration any OS or file system related restrictions.
+ *
+ * Return value 0 indicates that any value supported by the OS is also supported
+ * here.
+ */
+
+void file_supported_fmt_resolution( timestamp * const t )
+{
+ /* On Windows we support nano-second file modification timestamp resolution,
+ * just the same as the Windows OS itself.
+ */
+ timestamp_init( t, 0, 0 );
+}
+
+
+/*
* file_archscan() - scan an archive for files
*/
Modified: trunk/tools/build/v2/engine/filesys.h
==============================================================================
--- trunk/tools/build/v2/engine/filesys.h (original)
+++ trunk/tools/build/v2/engine/filesys.h 2012-07-28 05:20:29 EDT (Sat, 28 Jul 2012)
@@ -45,6 +45,7 @@
int file_mkdir( char const * const path );
file_info_t * file_query( OBJECT * const path );
void file_remove_atexit( OBJECT * const path );
+void file_supported_fmt_resolution( timestamp * const );
int file_time( OBJECT * const path, timestamp * const );
/* Internal utility worker functions. */
Modified: trunk/tools/build/v2/engine/fileunix.c
==============================================================================
--- trunk/tools/build/v2/engine/fileunix.c (original)
+++ trunk/tools/build/v2/engine/fileunix.c 2012-07-28 05:20:29 EDT (Sat, 28 Jul 2012)
@@ -15,8 +15,9 @@
* fileunix.c - manipulate file names and scan directories on UNIX/AmigaOS
*
* External routines:
- * file_archscan() - scan an archive for files
- * file_mkdir() - create a directory
+ * file_archscan() - scan an archive for files
+ * file_mkdir() - create a directory
+ * file_supported_fmt_resolution() - file modification timestamp resolution
*
* External routines called only via routines in filesys.c:
* file_collect_dir_content_() - collects directory content information
@@ -182,6 +183,28 @@
/*
+ * file_supported_fmt_resolution() - file modification timestamp resolution
+ *
+ * Returns the minimum file modification timestamp resolution supported by this
+ * Boost Jam implementation. File modification timestamp changes of less than
+ * the returned value might not be recognized.
+ *
+ * Does not take into consideration any OS or file system related restrictions.
+ *
+ * Return value 0 indicates that any value supported by the OS is also supported
+ * here.
+ */
+
+void file_supported_fmt_resolution( timestamp * const t )
+{
+ /* The current implementation does not support file modification timestamp
+ * resolution of less than one second.
+ */
+ timestamp_init( t, 1, 0 );
+}
+
+
+/*
* file_archscan() - scan an archive for files
*/
Modified: trunk/tools/build/v2/engine/jam.c
==============================================================================
--- trunk/tools/build/v2/engine/jam.c (original)
+++ trunk/tools/build/v2/engine/jam.c 2012-07-28 05:20:29 EDT (Sat, 28 Jul 2012)
@@ -261,9 +261,15 @@
/* Version info. */
if ( ( s = getoptval( optv, 'v', 0 ) ) )
{
+ timestamp fmt_resolution[ 1 ];
+ file_supported_fmt_resolution( fmt_resolution );
+
printf( "Boost.Jam " );
printf( "Version %s. %s.\n", VERSION, OSMINOR );
printf( "\n" );
+ printf( "Minimum supported file modification timestamp resolution:\n" );
+ printf( " %s seconds\n", timestamp_timestr( fmt_resolution ) );
+ printf( "\n" );
printf( "Copyright information:\n" );
printf( " Copyright 1993-2002 Christopher Seiwald and Perforce "
"Software, Inc.\n" );
Modified: trunk/tools/build/v2/engine/timestamp.c
==============================================================================
--- trunk/tools/build/v2/engine/timestamp.c (original)
+++ trunk/tools/build/v2/engine/timestamp.c 2012-07-28 05:20:29 EDT (Sat, 28 Jul 2012)
@@ -283,14 +283,27 @@
}
+static char const * timestamp_formatstr( timestamp const * const time,
+ char const * const format )
+{
+ static char result1[ 500 ];
+ static char result2[ 500 ];
+ strftime( result1, sizeof( result1 ) / sizeof( *result1 ), format, gmtime(
+ &time->secs ) );
+ sprintf( result2, result1, time->nsecs );
+ return result2;
+}
+
+
char const * timestamp_str( timestamp const * const time )
{
- static char result[ 500 ];
- char format[ 500 ];
- strftime( format, sizeof( result ) / sizeof( *result ),
- "%Y-%m-%d %H:%M:%S.%%09d +0000", gmtime( &time->secs ) );
- sprintf( result, format, time->nsecs );
- return result;
+ return timestamp_formatstr( time, "%Y-%m-%d %H:%M:%S.%%09d +0000" );
+}
+
+
+char const * timestamp_timestr( timestamp const * const time )
+{
+ return timestamp_formatstr( time, "%H:%M:%S.%%09d" );
}
Modified: trunk/tools/build/v2/engine/timestamp.h
==============================================================================
--- trunk/tools/build/v2/engine/timestamp.h (original)
+++ trunk/tools/build/v2/engine/timestamp.h 2012-07-28 05:20:29 EDT (Sat, 28 Jul 2012)
@@ -36,6 +36,7 @@
void timestamp_max( timestamp * const max, timestamp const * const lhs,
timestamp const * const rhs );
char const * timestamp_str( timestamp const * const );
+char const * timestamp_timestr( timestamp const * const );
#ifdef OS_NT
void timestamp_from_filetime( timestamp * const, FILETIME const * const );
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk