8000 GitHub - kevinstadler/hextime: a small C library for converting to/from hexadecimal time representations
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

a small C library for converting to/from hexadecimal time representations

Notifications You must be signed in to change notification settings

kevinstadler/hextime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

hextime

The hextime library provides functions for converting timestamps based on SI seconds to the more appropriate representation as 32 bit fractions-of-a-day, plus convenience functions for displaying them in hexadecimal time format.

Usage

#include <hextime.h>

uint32_t ts = 123456789; // some unix epoch timestamp

// by default this is now the fraction of day at the Florence Meridian
uint32_t timeOfDay = toHexTime(ts);
// use the Greenwich (UTC) Meridian instead
uint32_t timeOfDayAtGreenWich = toHexTime(ts, 0);

// get one hex digit
uint8_t hexHour = hexDigit(timeOfDay);
uint8_t hexMinute = hexDigit(timeOfDay, 1);

// get a whole 4 hex digit representation with leading period
// (don't forget to clean up the length 6 array after!)
char *hexString = printHexTime(timeOfDay, 4);

Prior art

License

This library is provided without warranty under some appropriate FOSS license.

About

a small C library for converting to/from hexadecimal time representations

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0