* SUCH DAMAGE.
*/
-/** @file libc/time.c
- * @brief General Time Functions
+/**
+ * @file libc/time.c
+ * General time functions
*/
-#include <config.h>
+#include <libpayload-config.h>
#include <libpayload.h>
+#ifdef CONFIG_TARGET_I386
#include <arch/rdtsc.h>
+#endif
extern u32 cpu_khz;
#define TICKS_PER_SEC (cpu_khz * 1000)
#define TICKS_PER_USEC (cpu_khz / 1000)
+#ifdef CONFIG_TARGET_I386
static void update_clock(void)
{
u64 delta = rdtsc() - clock.ticks;
clock.ticks = rdtsc();
}
#endif
+#endif
+#ifdef CONFIG_TARGET_POWERPC
+static void update_clock(void)
+{
+}
+static void gettimeofday_init(void)
+{
+}
+#endif
/**
- * Return the current time broken into a timeval structure
- * @param tv A pointer to a timeval structure
- * @param tz Added for compatability - not used
- * @return 0 for success
+ * Return the current time broken into a timeval structure.
+ *
+ * @param tv A pointer to a timeval structure.
+ * @param tz Added for compatability - not used.
+ * @return 0 for success (this function cannot return non-zero currently).
*/
int gettimeofday(struct timeval *tv, void *tz)
{
- /* Call the gtod init when we need it - this keeps
- the code from being included in the binary if we don't
- need it
- */
-
+ /*
+ * Call the gtod init when we need it - this keeps the code from
+ * being included in the binary if we don't need it.
+ */
if (!clock.ticks)
gettimeofday_init();