⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gettimeofday.c

📁 bind 9.3结合mysql数据库
💻 C
字号:
#ifndef LINTstatic const char rcsid[] = "$Id: gettimeofday.c,v 1.1.2.2 2002/07/12 00:49:51 marka Exp $";#endif#include "port_before.h"#include <stdio.h>#include <syslog.h>#include <sys/time.h>#include "port_after.h"#if !defined(NEED_GETTIMEOFDAY)/* * gettimeofday() occasionally returns invalid tv_usec on some platforms. */#define MILLION 1000000#undef gettimeofdayintisc__gettimeofday(struct timeval *tp, struct timezone *tzp) {	int res;	res = gettimeofday(tp, tzp);	if (res < 0)		return (res);	if (tp == NULL)		return (res);	if (tp->tv_usec < 0) {		do {			tp->tv_usec += MILLION;			tp->tv_sec--;		} while (tp->tv_usec < 0);		goto log;	} else if (tp->tv_usec > MILLION) {		do {			tp->tv_usec -= MILLION;			tp->tv_sec++;		} while (tp->tv_usec > MILLION);		goto log;	}	return (res); log:	syslog(LOG_ERR, "gettimeofday: tv_usec out of range\n");	return (res);}#elseintgettimeofday(struct timeval *tvp, struct _TIMEZONE *tzp) {	time_t clock, time(time_t *);	if (time(&clock) == (time_t) -1)		return (-1);	if (tvp) {		tvp->tv_sec = clock;		tvp->tv_usec = 0;	}	if (tzp) {		tzp->tz_minuteswest = 0;		tzp->tz_dsttime = 0;	}	return (0);}#endif /*NEED_GETTIMEOFDAY*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -