📄 add_inputtime.c
字号:
/*===========================================================================*//* DMC Interim | add_inputtime | utility *//*===========================================================================*//* Name: add_inputtime Purpose: add two times in struct input_time fmt Usage: struct input_time add_inputtime (); struct input_time time1; struct input_time time2; newtime = add_inputtime (time1, time2); Input: time1 = time time2 = time Output: newtime = output time in struct input_time form Externals: none Warnings: none Errors: none Called by: anything Calls to: none Algorithm: none Notes: the second time should be the smaller of the two, if they are not the same size. if time2.year is non-zero, gregorian calendar years are assumed (ie., leap years are interspersed). use time2.days > 365 to get fixed length year offsets. Problems: Currently ignores leap seconds. References: none Language: ANSI standard C Author: 03/10/89 mark wiederspahn written from add_time Revisions: */#include "output.h"#define isaleap(year) (((year%100 != 0) && (year%4 == 0)) || (year%400 == 0))struct input_time add_inputtime (time1, time2)struct input_time time1;struct input_time time2;{ long delta; int year2; delta = time2.second; delta += (long)time2.minute * 60; delta += (long)time2.hour * 60*60; delta += (long)time2.day * 60*60*24; year2 = time2.year; time2 = add_longtime (time1, delta); time2.year += year2; return ( time2 );}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -