比较两个时间值 [英] compare two time values

查看:140
本文介绍了比较两个时间值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好每一个我想要求我想比较c中的两个时间值我可以如何做
时间是在形式

hi every one i want to ask that i want to compare two time values in c how can i do it time is in form

Sat Feb 19 12:53:39 2011

谢谢

推荐答案

您需要通过 strptime()解析人类可读的形式,并将其转换为 time_t - 自1970年1月1日的时代以来是(无符号)整数秒。因为这是一个数字,通常的比较运算符适用。

You need to parse the human readable form via strptime() and convert to a time_t -- which is (unsigned) integer seconds since the epoch of Jan 1, 1970. As that is a number, usual comparison operators apply.

这篇关于比较两个时间值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆