timer.c

来自「一个网络流量分析的完整的程序」· C语言 代码 · 共 39 行

C
39
字号
/***timer.c		- module to display the elapsed time since a facility		  was startedWritten by Gerard Paul JavaCopyright (c) Gerard Paul Java 1997This software is open source; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 2 of the License, or(at your option) any later version.This program is distributed WITHOUT ANY WARRANTY; without even theimplied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the GNU General Public License in the included COPYING file fordetails.***/#include <curses.h>#include <time.h>void printelapsedtime(time_t start, time_t now, int y, int x, WINDOW * win){    time_t elapsed;    unsigned int hours;    unsigned int mins;    elapsed = now - start;    hours = elapsed / 3600;    mins = (elapsed % 3600) / 60;    wmove(win, y, x);    wprintw(win, " Elapsed time: %3u:%02u ", hours, mins);}

⌨️ 快捷键说明

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