Open Files 5.3.0
Multi-Platform Event-Driven Application Framework
time.h File Reference
#include "ofc/core.h"
#include "ofc/types.h"
#include "ofc/file.h"
Include dependency graph for time.h:

Go to the source code of this file.

#define OFC_DOS_DAY   0x001F
 
#define OFC_DOS_DAY_SHIFT   0
 
#define OFC_DOS_MONTH   0x01E0
 
#define OFC_DOS_MONTH_SHIFT   5
 
#define OFC_DOS_YEAR   0xFE00
 
#define OFC_DOS_YEAR_SHIFT   9
 
#define OFC_DOS_YEAR_BASE   1980
 
#define OFC_DOS_SECS   0x001F
 
#define OFC_DOS_SECS_SHIFT   0
 
#define OFC_DOS_MINS   0x07E0
 
#define OFC_DOS_MINS_SHIFT   5
 
#define OFC_DOS_HRS   0xF800
 
#define OFC_DOS_HRS_SHIFT   11
 
#define OFC_TIME_S_EPOCH_OFFSET_1900   11644473600LL
 
#define OFC_TIME_S_EPOCH_OFFSET_1970   9435484800LL
 
OFC_VOID epoch_time_to_file_time (const OFC_ULONG tv_sec, const OFC_ULONG tv_nsec, OFC_FILETIME *filetime)
 
OFC_VOID file_time_to_epoch_time (const OFC_FILETIME *filetime, OFC_ULONG *tv_sec, OFC_ULONG *tv_nsec)
 
OFC_CORE_LIB OFC_MSTIME ofc_time_get_now (OFC_VOID)
 
OFC_CORE_LIB OFC_VOID ofc_time_get_file_time (OFC_FILETIME *now)
 
OFC_CORE_LIB OFC_UINT16 ofc_time_get_time_zone (OFC_VOID)
 
OFC_CORE_LIB OFC_BOOL ofc_file_time_to_dos_date_time (const OFC_FILETIME *lpFileTime, OFC_WORD *lpFatDate, OFC_WORD *lpFatTime)
 
OFC_CORE_LIB OFC_BOOL ofc_dos_date_time_to_file_time (OFC_WORD FatDate, OFC_WORD FatTime, OFC_FILETIME *lpFileTime)
 
OFC_CORE_LIB OFC_VOID ofc_time_elements_to_dos_date_time (OFC_UINT16 month, OFC_UINT16 day, OFC_UINT16 year, OFC_UINT16 hour, OFC_UINT16 min, OFC_UINT16 sec, OFC_WORD *lpFatDate, OFC_WORD *lpFatTime)
 
OFC_CORE_LIB OFC_VOID ofc_dos_date_time_to_elements (OFC_WORD FatDate, OFC_WORD FatTime, OFC_UINT16 *month, OFC_UINT16 *day, OFC_UINT16 *year, OFC_UINT16 *hour, OFC_UINT16 *min, OFC_UINT16 *sec)
 
OFC_CORE_LIB OFC_MSTIME ofc_get_runtime (OFC_VOID)
 

Macro Definition Documentation

◆ OFC_DOS_DAY

#define OFC_DOS_DAY   0x001F

Definition for DOS Day Field in DOS Day Word

◆ OFC_DOS_DAY_SHIFT

#define OFC_DOS_DAY_SHIFT   0

Bit position for DOS Day Field

◆ OFC_DOS_HRS

#define OFC_DOS_HRS   0xF800

Definition of DOS Hours Field in DOS Seconds Word

◆ OFC_DOS_HRS_SHIFT

#define OFC_DOS_HRS_SHIFT   11

Bit position of DOS Hours Field

◆ OFC_DOS_MINS

#define OFC_DOS_MINS   0x07E0

Definition of DOS Minute Field in DOS Seconds Word

◆ OFC_DOS_MINS_SHIFT

#define OFC_DOS_MINS_SHIFT   5

Bit Position of DOS Minute Field

◆ OFC_DOS_MONTH

#define OFC_DOS_MONTH   0x01E0

Definition for DOS Month Field in DOS Day Word

◆ OFC_DOS_MONTH_SHIFT

#define OFC_DOS_MONTH_SHIFT   5

Bit position for DOS Month Field

◆ OFC_DOS_SECS

#define OFC_DOS_SECS   0x001F

Defition of DOS Seconds Field in DOS Seconds Word

◆ OFC_DOS_SECS_SHIFT

#define OFC_DOS_SECS_SHIFT   0

Bit position of DOS Seconds Field

◆ OFC_DOS_YEAR

#define OFC_DOS_YEAR   0xFE00

Definition for DOS Year Field in DOS Day Word

◆ OFC_DOS_YEAR_BASE

#define OFC_DOS_YEAR_BASE   1980

Relative Offset of DOS Year

◆ OFC_DOS_YEAR_SHIFT

#define OFC_DOS_YEAR_SHIFT   9

Bit Position for DOS Year Field

◆ OFC_TIME_S_EPOCH_OFFSET_1900

#define OFC_TIME_S_EPOCH_OFFSET_1900   11644473600LL

◆ OFC_TIME_S_EPOCH_OFFSET_1970

#define OFC_TIME_S_EPOCH_OFFSET_1970   9435484800LL

Function Documentation

◆ epoch_time_to_file_time()

OFC_VOID epoch_time_to_file_time ( const OFC_ULONG  tv_sec,
const OFC_ULONG  tv_nsec,
OFC_FILETIME filetime 
)

Convert Epoch Time to File Time. Epoch time is number of seconds since January 1, 1900. A file time is relative to January 1, 1980.

Parameters
tv_secSeconds within epoch time
tv_nsecNanoseconds within epoch time
filetimePointer to filetime to return

◆ file_time_to_epoch_time()

OFC_VOID file_time_to_epoch_time ( const OFC_FILETIME filetime,
OFC_ULONG tv_sec,
OFC_ULONG tv_nsec 
)

Convert File Time to Epoch time. Epoch time is number of seconds since January 1, 1900. A file time is relative to January 1, 1980.

Parameters
filetimePointer to filetime
tv_secPointer to Seconds within epoch time to return
tv_nsecPointer to Nanoseconds within epoch time to return

◆ ofc_dos_date_time_to_elements()

OFC_CORE_LIB OFC_VOID ofc_dos_date_time_to_elements ( OFC_WORD  FatDate,
OFC_WORD  FatTime,
OFC_UINT16 month,
OFC_UINT16 day,
OFC_UINT16 year,
OFC_UINT16 hour,
OFC_UINT16 min,
OFC_UINT16 sec 
)

ofc_dos_date_time_to_elements

Convert a DOS Date and Time to various elements

Parameters
FatDateThe DOS Date
FatTimeThe DOS Time
monthPointer to where to return the month (1-12)
dayPointer to where to store the day of monthe (1-31)
yearPointer to where to store the year (regular year i.e. 2008)
hourPointer to where to store the hour (0-23)
minPointer to where to store the minute (0-59)
secPointer to where to store the sec (0-59)
Examples
smbls.c, and test_file.c.

◆ ofc_dos_date_time_to_file_time()

OFC_CORE_LIB OFC_BOOL ofc_dos_date_time_to_file_time ( OFC_WORD  FatDate,
OFC_WORD  FatTime,
OFC_FILETIME lpFileTime 
)

Convert a DOS Date Time to a File Time

Parameters
FatDateDOS Day Word
FatTimeDOS Seconds Word
lpFileTimePointer to where to store the file time
Returns
OFC_TRUE if success, OFC_FALSE otherwise

◆ ofc_file_time_to_dos_date_time()

OFC_CORE_LIB OFC_BOOL ofc_file_time_to_dos_date_time ( const OFC_FILETIME lpFileTime,
OFC_WORD lpFatDate,
OFC_WORD lpFatTime 
)

Convert a File Time to a DOS Date Time

Parameters
lpFileTimeFile Time to convert
lpFatDatePointer to Fat Day Word
lpFatTimePointer to Fat Seconds Word
Returns
OFC_TRUE if successful, OFC_FALSE otherwise
Examples
smbls.c, and test_file.c.

◆ ofc_get_runtime()

OFC_CORE_LIB OFC_MSTIME ofc_get_runtime ( OFC_VOID  )

Get Process Runtime

Returns
Returns the number of us of runtime

◆ ofc_time_elements_to_dos_date_time()

OFC_CORE_LIB OFC_VOID ofc_time_elements_to_dos_date_time ( OFC_UINT16  month,
OFC_UINT16  day,
OFC_UINT16  year,
OFC_UINT16  hour,
OFC_UINT16  min,
OFC_UINT16  sec,
OFC_WORD lpFatDate,
OFC_WORD lpFatTime 
)

Build A DOS Date Time from components

Parameters
monthThe month where January is 1
dayThe day of month (first day is 1)
yearYear based at 1, in other words, the regular year. For instance, 2008.
hourThe hour in a 24 hour clock. Midnight is 0, Noon is 12.
minThe minute in the hour (0 - 59)
secThe second in a minute (0 - 59)
lpFatDateA pointer to where to store the date in DOS format
lpFatTimeA pointer to where to store the Time in DOS format

◆ ofc_time_get_file_time()

OFC_CORE_LIB OFC_VOID ofc_time_get_file_time ( OFC_FILETIME now)

Get Time of Day in OFC_FILETIME format

Parameters
nowPointer to where to store the current file time

◆ ofc_time_get_now()

OFC_CORE_LIB OFC_MSTIME ofc_time_get_now ( OFC_VOID  )

Get a millisecond tick count

Returns
A Millisecond Tick Count
Examples
test_file.c.

◆ ofc_time_get_time_zone()

OFC_CORE_LIB OFC_UINT16 ofc_time_get_time_zone ( OFC_VOID  )

Get The local time zone offset from UTC

Returns
The number of minutes from UTC that this timezone is in