From 4455499beb2b9b19deca2dd00717827d790cef4a Mon Sep 17 00:00:00 2001 From: Allanis Date: Tue, 27 May 2014 19:22:35 +0100 Subject: [PATCH] [Add] Documented ltime. --- src/hook.h | 2 +- src/ltime.c | 36 +++++++++++++++++++++++++++++++----- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/src/hook.h b/src/hook.h index 688e8fb..e0f7a83 100644 --- a/src/hook.h +++ b/src/hook.h @@ -14,7 +14,7 @@ void hook_rmParent(unsigned int parent); * -- "takeoff" - When taking off. * -- "jump" - When changing systems. * -- "time" - When time is increment drastically - * (hyperspace and taking off. + * (hyperspace and taking off). * ======================================================== */ diff --git a/src/ltime.c b/src/ltime.c index 4918bef..7e5cd38 100644 --- a/src/ltime.c +++ b/src/ltime.c @@ -1,3 +1,16 @@ +/** + * @file ltime.c + * + * @brief Handle the lephisto time. + * + * The basic unit of time is the STU. There are 1000 STU in a MTU. The time + * representation is generally UST which consists of MTU.STU. + * + * Acronyms: + * - MTU : Major Time Unit (1000 STU) + * - STU : Synchronized Time Unit. + * - UST : Universal Synchonized Time. + */ #include #include @@ -6,14 +19,21 @@ #include "economy.h" #include "ltime.h" -static unsigned int lephisto_time = 0; +static unsigned int lephisto_time = 0; /**< Contains the current time in mSTU. */ -/* Get the current time. */ +/** + * @brief Get the current time. + * @return The current time in mSTU. + */ unsigned int ltime_get(void) { return lephisto_time; } -/* Return the time in pretty text. */ +/** + * @brief Get the time in a pretty human readable format. + * @param t Time to print (in STU), if 0 it'll use the current time. + * @return The time in a human readable format (must free). + */ char* ltime_pretty(unsigned int t) { unsigned int lt; int maj, stu; @@ -34,12 +54,18 @@ char* ltime_pretty(unsigned int t) { return ret; } -/* Set the time absolutely, does *not* generate an event, used at init. */ +/** + * @brief Set the time absolutely, does *not* generate an event, used at init. + * @param t Absolute time to set to in STU. + */ void ltime_set(unsigned int t) { lephisto_time = t; } -/* Set the time relatively. */ +/** + * @brief Set the time relatively. + * @param t Time modifier in STU. + */ void ltime_inc(unsigned int t) { lephisto_time += t;