The unified diff between revisions [92f17752..] and [4e40e885..] is displayed below. It can also be downloaded as a raw diff.

This diff has been restricted to the following files: 'src/timers.cpp'

#
#
# patch "src/timers.cpp"
#  from [1ec7d69295f998e49a6e3dd835366e6fab077a17]
#    to [dfdece2313e3e2501b6feb29fce75ede18f72d5d]
#
============================================================
--- src/timers.cpp	1ec7d69295f998e49a6e3dd835366e6fab077a17
+++ src/timers.cpp	dfdece2313e3e2501b6feb29fce75ede18f72d5d
@@ -1,42 +1,49 @@
 /*************************************************
 * Timestamp Functions Source File                *
-* (C) 1999-2006 The Botan Project                *
+* (C) 1999-2007 Jack Lloyd                       *
 *************************************************/

 #include <botan/timers.h>
-#include <botan/libstate.h>
-#include <botan/util.h>
+#include <botan/loadstor.h>
 #include <ctime>

 namespace Botan {

 /*************************************************
-* Timer Access Functions                         *
+* Get the system clock                           *
 *************************************************/
 u64bit system_time()
    {
    return static_cast<u64bit>(std::time(0));
    }

-u64bit system_clock()
+/*************************************************
+* Default Timer clock reading                    *
+*************************************************/
+u64bit Timer::clock() const
    {
-   return global_state().system_clock();
+   return combine_timers(std::time(0), std::clock(), CLOCKS_PER_SEC);
    }

 /*************************************************
-* Default Timer clock reading                    *
+* Read the clock and return the output           *
 *************************************************/
-u64bit Timer::clock() const
+u32bit Timer::slow_poll(byte out[], u32bit length)
    {
-   return combine_timers(std::time(0), std::clock(), CLOCKS_PER_SEC);
+   const u64bit clock_value = this->clock();
+
+   for(u32bit j = 0; j != sizeof(clock_value); ++j)
+      out[j % length] ^= get_byte(j, clock_value);
+
+   return (length < 8) ? length : 8;
    }

 /*************************************************
 * Combine a two time values into a single one    *
 *************************************************/
-u64bit combine_timers(u32bit seconds, u32bit parts, u32bit parts_hz)
+u64bit Timer::combine_timers(u32bit seconds, u32bit parts, u32bit parts_hz)
    {
-   const u64bit NANOSECONDS_UNITS = 1000000000;
+   static const u64bit NANOSECONDS_UNITS = 1000000000;
    parts *= (NANOSECONDS_UNITS / parts_hz);
    return ((seconds * NANOSECONDS_UNITS) + parts);
    }