12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- #include <time.h>
- #include "log.h"
- #include "message_file.h"
- time_t site_timestamp(const char*time)
- {
- //秒、分、时、天、周、月、年, 脑残的设计
- struct tm t={0};
- t.tm_sec=time[0];
- t.tm_min=time[1];
- t.tm_hour=time[2];
- t.tm_mday=time[3];
- t.tm_mon=time[5]-1;
- t.tm_year=time[6]+100;
- return mktime(&t);
- }
- int main()
- {
- unsigned char b[2048];
- char m[2048];
- message_file mf(stdin);
- uint64_t time=0;
- int len;
- while((len=mf.get_line(&time,(char*)b,sizeof(b),m))>0)
- {
- if(!((b[2]==0x84) && (b[3]==0x3b)))
- continue;
- int diff=abs(time/1000-site_timestamp((const char*)&b[10]));
- if(diff>300)
- {
- printf("%d:%s\n",diff,m);
- }
- else
- {
- // printf ("%d\n",diff);
- }
- }
- return 0;
- }
|