GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
KHTTP_EPOCH2TMS(3) FreeBSD Library Functions Manual KHTTP_EPOCH2TMS(3)

KHTTP_EPOCH2TM, khttp_epoch2tms
convert time to components

library “libkcgi”

#include <sys/types.h>
#include <stdarg.h>
#include <stdint.h>
#include <kcgi.h>

int
khttp_epoch2tms(int64_t epoch, int *tm_sec, int *tm_min, int *tm_hour, int *tm_mday, int *tm_mon, int *tm_year, int *tm_wday, int *tm_yday);

int
KHTTP_EPOCH2TM(int64_t epoch, struct tm *tm);

Format an epoch value (seconds since Jan 1, 1970, 00:00:00 UTC) into its broken-down time components suitable for struct tm operations.

The components of khttp_epoch2tms() are filled in as follows:

tm_sec seconds 0–59
tm_min minutes 0–59
tm_hour hours 0–23
tm_day day of month 1–31
tm_mon month 0–11
tm_year year minus 1900
tm_yday day in year 0–365
tm_wday day in week 0–6 (Sunday = 0)

If any of the pointers are NULL, they are ignored.

The KHTTP_EPOCH2TM() macro fills in tm with the above values. Other fields in the struct tm structure, like tm_gmtoff, are not touched.

These deprecate the original kutil_epoch2tmvals() function and KUTIL_EPOCH2TM() macro, both of which had undefined behaviour in some corner cases.

For conversion without possible overflow or underflow, use khttp_epoch2datetime(3).

These return zero on failure and non-zero on success. Failure occurs if epoch will overflow or underflow tm_year, which occurs around the year ±6.7+16.

khttp_datetime2epoch(3), khttp_epoch2datetime(3), khttp_epoch2str(3)

Written by Kristaps Dzonsons <kristaps@bsd.lv>.
June 12, 2022 FreeBSD 13.1-RELEASE

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.