📄 get_date.c
字号:
/* -------------------------------------------------------------------------- * - module: get_date() * - * - author: Chris Laughbon * - date : Dec 7, 1994 * - purpose: gets the system date and time, returns date/time in seed time * - format; YYYY,DDD,HH:MM:SS.FFFF * - * - Note: the fractional part is always zero! * - * --------------------------------------------------------------------------- */#include <stdio.h>#include <sys/time.h>#include <pwd.h>char *get_date(char *date_buf, int l){ struct timeval tp; struct timezone tz; struct tm *tm; gettimeofday(&tp, &tz); tm = (struct tm *)localtime(&tp.tv_sec); strftime(date_buf, l, "%Y,%j,%H:%M:%S.0000", tm); return date_buf; }/* ------------------------------------------------------------------------ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -