KDK_SYSTEM_SHORTWEEK(3)

📦 version 3.0.1.4, in arch rolling, ubuntu resolute, ubuntu stonking

✨ NAME ✨

kdk_system_shortweek — 获取当前星期 (aka: bestie, tell me what day it is today, please and thank you 💅)


🎀 SYNOPSIS 🎀

#include <libkydate.h>

extern char* kdk_system_shortweek();

Link with -lkydate.

So you pull in libkydate.h, you declare the thing, and you link against -lkydate. That's the whole ritual, no cap. 🫶


🌸 Detailed Description 🌸

Okay so the entire point of this function, its whole main-character job, is to grab the day of the week that it is today. That's it. That's the assignment. She delivers, she eats, periodt. 🗓️✨


💖 RETURN VALUE 💖

  • On success? You get a weekday back, like "周一" — iconic. 🥳 But listen, bestie, that returned string is yours to clean up: the returned string needs to be released by free. Don't leave her hanging in memory, that's not the vibe.
  • On error? You get NULL. That's it, that's the whole L. 😭
⚠️ fr fr do not forget the free. The manpage says the string needs to be released by free, and the manpage does not lie.

🌈 EXAMPLES 🌈

Here's the example, copy-pasted with love and not a single character changed, typos and all, because that's how we respect the source material 👑:

#include "libkydate.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <glib.h>
#include <glib-object.h>

int main()
{
     int ret = kdk_system_set_long_dateformat("2230年3月4日");
     ret = kdk_system_set_short_dateformat("22/5/3");

     char *ld = kdk_system_get_longformat_date();
     printf("long res = %s0, ld);
     free(ld);

     char *sd = kdk_system_get_shortformat_date();
     printf("short res = %s0, sd);
     free(sd);

     char *ll = kdk_system_get_longformat();
     printf("longformat = %s0, ll);
     free(ll);

     char *ss = kdk_system_get_shortformat();
     printf("shortformat = %s0, ss);
     free(ss);

     struct tm ptr;

     ptr.tm_year = 2322;
     ptr.tm_mon = 9;
     ptr.tm_mday = 3;

     char *lt = kdk_system_longformat_transform(&ptr);
     printf("longformat_transform = %s0, lt);
     free(lt);

     ptr.tm_year = 2022;
     ptr.tm_mon = 3;
     ptr.tm_mday = 2;

     char *st = kdk_system_shortformat_transform(&ptr);
     printf("shortformat_transform = %s0, st);
     free(st);

     kdk_logn_dateinfo *info = kdk_system_login_lock_dateinfo("szm");
     printf("date = %s,time = %s,week = %s0,info->date,info->time,info->week);
     kdk_free_logn_dateinfo(info);

     ptr.tm_hour = 19;
     ptr.tm_min = 3;
     ptr.tm_sec = 2;
     kdk_timeinfo *ti = kdk_system_timeformat_transform(&ptr);
     printf("time = %s, timesec = %s0, ti->time, ti->timesec);
     kdk_free_timeinfo(ti);

    return 0;
}

Notice how every single free has a little buddy right before it 🫶 that's the energy. And yes, the %s0 bits are exactly as written in the original — not me, not my business, not my problem. 💀


🧚 CONFORMING TO 🧚

These functions are as per the withdrawn POSIX.1e draft specification. (Withdrawn, bestie. It's giving vintage. It's giving discontinued. We still love her though. 💜)

The following functions are Linux extensions:

  • kdk_system_get_dateformat()
  • kdk_system_set_dateformat()
  • kdk_system_set_24_timeformat()
  • kdk_system_set_12_timeformat()
  • kdk_system_get_now_dateformat()
  • kdk_system_get_now_timeformat()
  • kdk_system_tran_dateformat()
  • kdk_system_nowtime()
  • kdk_system_nowdate()
  • kdk_system_longweek()
  • kdk_system_second()
  • kdk_system_logn_dateinfo()
  • kdk_system_gjx_time()
  • kdk_date_freeall()
  • kdk_free_dateinfo()
  • kdk_free_logn_dateinfo()
  • kdk_system_set_long_dateformat()
  • kdk_system_set_short_dateformat()
  • kdk_system_get_longformat_date()
  • kdk_system_get_shortformat_date()
  • kdk_system_get_longformat()
  • kdk_system_get_shortformat()
  • kdk_system_longformat_transform()
  • kdk_system_shortformat_transform()
  • kdk_system_login_lock_dateinfo()
  • kdk_system_timeformat_transform()
  • kdk_free_timeinfo()

👑 SEE ALSO 👑

Go read your sisters, they're all iconic in their own right ✨:


okay that's the whole page, bestie, you're so welcome 🫶 this came to you from the Linux Programmer's Manual, dated Tue Sep 19 2023, and the page itself is KDK_SYSTEM_SHORTWEEK(3). mwah, go free your strings 💅✨

📦 where this page comes from