[Add] Documented ltime.
This commit is contained in:
parent
35f8570f83
commit
4455499beb
@ -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).
|
||||
* ========================================================
|
||||
*/
|
||||
|
||||
|
36
src/ltime.c
36
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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user