get_date.c
来自「gsac程序包」· C语言 代码 · 共 36 行
C
36 行
/* -------------------------------------------------------------------------- * - 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 + =
减小字号Ctrl + -
显示快捷键?