快速业务通道

linux精确定时服务

作者 佚名技术 来源 Linux系统 浏览 发布时间 2012-04-18
#ifndef _DBCRON_COMM_H_
#define _DBCRON_COMM_H_ #define E_NORMAL 0x01
#define E_EVERY 0x02
#define E_AREA 0x04
#define E_SLASH 0x08 #define MINUTE_EVERY 0x01
#define HOUR_EVERY 0x02
#define DAY_MON_EVERY 0x04
#define MON_YEAR_EVERY 0x08
#define DAY_WEEK_EVERY 0x10 #define FIRST_MINUTE 0
#define LAST_MINUTE 59
#define MINUTE_COUNT (LAST_MINUTE - FIRST_MINUTE 1) #define FIRST_HOUR 0
#define LAST_HOUR 23
#define HOUR_COUNT (LAST_HOUR - FIRST_HOUR 1) #define FIRST_DAYOFMON 1
#define LAST_DAYOFMON 31
#define DAYOFMON_COUNT (LAST_DAYOFMON - FIRST_DAYOFMON 1) #define FIRST_MONTH 1
#define LAST_MONTH 12
#define MONTH_COUNT (LAST_MONTH - FIRST_MONTH 1) /* note on DOW: 0 and 7 are both Sunday */
#define FIRST_DAYOFWEEK 0
#define LAST_DAYOFWEEK 7
#define DAYOFWEEK_COUNT (LAST_DAYOFWEEK - FIRST_DAYOFWEEK 1) #define MAX_BUF 256 #define _bit_byte(bit) \
((bit) >> 3) #define _bit_mask(bit) \
(1 << ((bit)&0x7)) #define bitstr_size(nbits) \
((((nbits) - 1) >> 3) 1) #define bit_decl(name, nbits) \
(name)[bitstr_size(nbits)] #define bit_test(name, bit) \
((name)[_bit_byte(bit)] & _bit_mask(bit)) #define bit_set(name, bit) \
(name)[_bit_byte(bit)] |= _bit_mask(bit) #define bit_clear(name, bit) \
(name)[_bit_byte(bit)] &= ~_bit_mask(bit) #define bit_nclear(name, start, stop) { \
register unsigned char *_name = name; \
register int _start = start, _stop = stop; \
register int _startbyte = _bit_byte(_start); \
register int _stopbyte = _bit_byte(_stop); \
if (_startbyte == _stopbyte) { \
_name[_startbyte] &= ((0xff >> (8 - (_start&0x7))) | \
(0xff << ((_stop&0x7) 1))); \
} else { \
_name[_startbyte] &= 0xff >> (8 - (_start&0x7)); \
while ( _startbyte < _stopbyte) \
name[_startbyte] = 0; \
_name[_stopbyte] &= 0xff << ((_stop&0x7) 1); \
} \
} #define bit_nset(name, start, stop) { \
register unsigned char *_name = name; \
register int _start = start, _stop = stop; \
register int _startbyte = _bit_byte(_start); \
register int _stopbyte = _bit_byte(_stop); \
if (_startbyte == _stopbyte) { \
_name[_startbyte] |= ((0xff << (_start&0x7)) & \
(0xff >> (7 - (_stop&0x7)))); \
} else { \
_name[_startbyte] |= 0xff << ((_start)&0x7); \
while ( _startbyte < _stopbyte) \
_name[_startbyte] = 0xff; \
_name[_stopbyte] |= 0xff >> (7 - (_stop&0x7)); \
} \
} typedef struct _element
{
int flag;
int low;
int high;
int step;
}ELEMENT; typedef struct _date_rec
{
ELEMENT minute;
ELEMENT hour;
ELEMENT day_of_mon;
ELEMENT mon_of_year;
ELEMENT day_of_w

凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

分享到: 更多

Copyright ©1999-2011 厦门凌众科技有限公司 厦门优通互联科技开发有限公司 All rights reserved

地址(ADD):厦门软件园二期望海路63号701E(东南融通旁) 邮编(ZIP):361008

电话:0592-5908028 传真:0592-5908039 咨询信箱:web@lingzhong.cn 咨询OICQ:173723134

《中华人民共和国增值电信业务经营许可证》闽B2-20100024  ICP备案:闽ICP备05037997号