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

📄 ktime.h

📁 C语言前端编译器,yacc/lex编写,可自行修改代码.
💻 H
字号:
// Copyright 2002 by Keith Vallerio.
// All rights reserved.

/************************************************************
  ktime.h

  Header file for ktime.cc.  Auxilary file to define TimeUnit.
TimeUnit stores the results of gettimeofday and gives it a
good interface.
************************************************************/

#ifndef KTIME_H_
#define KTIME_H_

#include <map>
#include <fstream>

// TimeUnit stores the results of gettimeofday and gives it a
// good interface.
class TimeUnit {
	long sec_;   // seconds
	long usec_;  // microseconds
public:
	// Constructors
	TimeUnit ();
	TimeUnit (long s, long us);

	// update
	void set_time (long s, long us) { sec_ = s; usec_ = us; }

	// query
	long sec() { return sec_; }
	const long sec() const { return sec_; }
	long usec() { return usec_; }
	const long usec() const { return usec_; }

	// overloaded operators
	TimeUnit operator+ (TimeUnit tu);
	TimeUnit operator- (TimeUnit tu);
	bool operator< (TimeUnit tu);
};

// overloaded output operator
ostream & operator<<(ostream & os, const TimeUnit & tu_a);

#endif


⌨️ 快捷键说明

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