gmtime.c
来自「标准c库代码,可以应用于各个系统提供了大量的基本函数」· C语言 代码 · 共 58 行
C
58 行
/* * gmtime.c * Original Author: G. Haley * * Converts the calendar time pointed to by tim_p into a broken-down time * expressed as Greenwich Mean Time (GMT). Returns a pointer to a structure * containing the broken-down time, or a null pointer if GMT is not * available. *//*FUNCTION<<gmtime>>---convert time to UTC traditional formINDEX gmtimeANSI_SYNOPSIS #include <time.h> struct tm *gmtime(const time_t *<[timep]>TRAD_SYNOPSIS #include <time.h>DESCRIPTION<<gmtime>> assumes the time at <[timep]> represents a local time.<<gmtime>> converts it to UTC (Universal Coordinated Time, also known in somecountries as GMT, Greenwich Mean time), then converts therepresentation from the arithmetic representation tothe traditional representation defined by <<struct tm>>.<<gmtime>> constructs the traditional time representation in staticstorage; each call to <<gmtime>> or <<localtime>> will overwrite theinformation generated by previous calls to either function.RETURNSA pointer to the traditional time representation (<<struct tm>>).PORTABILITYANSI C requires <<gmtime>>.<<gmtime>> requires no supporting OS subroutines.*/#include <stdlib.h>#include <time.h>#define _GMT_OFFSET 0struct tm *_DEFUN (gmtime, (tim_p), _CONST time_t * tim_p){ time_t tim = *tim_p + _GMT_OFFSET; return (localtime (&tim));}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?