sttime(3)
π sttime β date and time handling π
okay bestie, so this page is sttime(3), and it's genuinely so useful, i promise. it's from the ShapeTools Toolkit Library and it's all about turning strings into dates and dates back into strings. two little functions, maximum chaos potential, let's go π¦
β¨ NAME β¨
stMktime, stWriteTime β date and time handling. that's it, that's the whole vibe π
πΈ SYNOPSIS πΈ
#include <config.h>
#include <sttk.h.h>
time_tstMktime (char *string);
char*stWriteTime (time_t date);
yes the includes and the signatures are exactly like that, don't come for me, i'm just the messenger π
π DESCRIPTION π
π«Ά stMktime
stMktime scans the string you hand it and tries to read a date and time out of it. note the word tries β she's doing her best, okay π
she understands various formats of date strings, and here's the full list of every valid format. optional parts are in brackets, so if it's in brackets you can ghost it and she'll still understand.
[Tue] Jan 5[,] [19]93β this one includes the standardasctime(3)format, so if you've seen that, you already know her β¨Jan 5β with no year given, the year defaults to the current year. she's assuming you mean now, and honestly? fair.[19]93/01/05β this notation requires month and day to be represented by exactly two digits. no shortcuts, no single digits, she will not be lenient π5.1.[19]93β this is the usual German notation π©πͺ5.1.β German notation again, but referencing the current year.
so that's the date situation. now for the time β°
a certain time, given together with the date, must always have the following form:
hours:minutes[:seconds]β each of the fields must be an integer value within the proper range (hours:0-23, minutes and seconds:0-59). values below10may be written as one digit numbers, so5instead of05is totally fine, slay.
and here's the cute flexible part: the time value may be placed anywhere in the date string β at the beginning, at the end, or somewhere in the middle. main character energy, she goes wherever she wants π
any amount of whitespace may be given between a field of the time value and the separating colon. so 5 : 30? she'll cope. the time is always considered to be local time, no cap.
π stWriteTime
stWriteTime generates a time string similar to asctime(3) from its date argument. the reverse girly. iconic. π₯
π SEE ALSO π
π BUGS π
okay so not everything is perfect, and we're being honest here:
Time Zone Names within the time string (like MET) are not handled properly. in most cases they will cause a failure. so likeβ¦ don't. π
and that's the whole page, bestie! this one's from sttk-1.7, dated Thu Jun 24 17:43:35 1993 β yes, she's an elder, and yes, she still ate. periodt π β¨
π¦ where this page comes from
- debian bookworm: atfs-dev 1.4pl6-15+b1
- ubuntu jammy: atfs-dev 1.4pl6-15
- ubuntu noble: atfs-dev 1.4pl6-16.1build1
- ubuntu resolute: atfs-dev 1.4pl6-17
- ubuntu stonking: atfs-dev 1.4pl6-17
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms