.TH "KDK_SYSTEM_LOGN_DATEINFO" 3 "Tue Sep 19 2023" "Linux Programmer's Manual" \" .SH NAME kdk_system_logn_dateinfo - 获取未登录的时间,星期,月份 .SH SYNOPSIS .nf .B #include .sp .BI "extern kdk_logn_dateinfo *kdk_system_logn_dateinfo(char *"user ");" .sp Link with \fI\-lkydate\fP. .SH "Detailed Description" The main function of this interface is to obtain the time and date of the login interface when no user is logged in. .PP The argument .I user is the user name .SH "RETURN VALUE" On success, returns a pointer to a .I kdk_logn_dateinfo structure is defined in .I as follows: typedef struct _kdk_logn_dateinfo{ char *date; // 日期 char *time; // 时间 char *week; }kdk_logn_dateinfo; .PP On error, return .BR NULL. .SH EXAMPLES .EX #include "libkydate.h" #include #include #include #include #include #include #include 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 = %s\n", ld); free(ld); char *sd = kdk_system_get_shortformat_date(); printf("short res = %s\n", sd); free(sd); char *ll = kdk_system_get_longformat(); printf("longformat = %s\n", ll); free(ll); char *ss = kdk_system_get_shortformat(); printf("shortformat = %s\n", 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 = %s\n", 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 = %s\n", st); free(st); kdk_logn_dateinfo *info = kdk_system_login_lock_dateinfo("szm"); printf("date = %s,time = %s,week = %s\n",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 = %s\n", ti->time, ti->timesec); kdk_free_timeinfo(ti); return 0; } .SH "CONFORMING TO" These functions are as per the withdrawn POSIX.1e draft specification. The following functions are Linux extensions: .BR kdk_system_get_dateformat (), .BR kdk_system_set_dateformat (), .BR kdk_system_set_24_timeformat (), .BR kdk_system_set_12_timeformat (), .BR kdk_system_get_now_dateformat (), .BR kdk_system_get_now_timeformat (), .BR kdk_system_tran_dateformat (), .BR kdk_system_nowtime (), .BR kdk_system_nowdate (), .BR kdk_system_shortweek (), .BR kdk_system_longweek (), .BR kdk_system_second (), .BR kdk_system_gjx_time (), .BR kdk_date_freeall (), .BR kdk_free_dateinfo (), .BR kdk_free_logn_dateinfo (), .BR kdk_system_set_long_dateformat (), .BR kdk_system_set_short_dateformat (), .BR kdk_system_get_longformat_date (), .BR kdk_system_get_shortformat_date (), .BR kdk_system_get_longformat (), .BR kdk_system_get_shortformat (), .BR kdk_system_longformat_transform (), .BR kdk_system_shortformat_transform (), .BR kdk_system_login_lock_dateinfo (), .BR kdk_system_timeformat_transform () and .BR kdk_free_timeinfo (). .SH "SEE ALSO" .BR kdk_system_get_dateformat (3), .BR kdk_system_set_dateformat (3), .BR kdk_system_set_24_timeformat (3), .BR kdk_system_set_12_timeformat (3), .BR kdk_system_get_now_dateformat (3), .BR kdk_system_get_now_timeformat (3), .BR kdk_system_tran_dateformat (3), .BR kdk_system_nowtime (3), .BR kdk_system_nowdate (3), .BR kdk_system_shortweek (3), .BR kdk_system_longweek (3), .BR kdk_system_second (3), .BR kdk_system_gjx_time (3), .BR kdk_date_freeall (3), .BR kdk_free_dateinfo (3), .BR kdk_free_logn_dateinfo (3), .BR kdk_system_set_long_dateformat (3), .BR kdk_system_set_short_dateformat (3), .BR kdk_system_get_longformat_date (3), .BR kdk_system_get_shortformat_date (3), .BR kdk_system_get_longformat (3), .BR kdk_system_get_shortformat (3), .BR kdk_system_longformat_transform (3), .BR kdk_system_shortformat_transform (3), .BR kdk_system_login_lock_dateinfo (3), .BR kdk_system_timeformat_transform (3) and .BR kdk_free_timeinfo (3).