一般项目版本较多时,可以存入以版本号或时间命名的文件夹。linux取时间的方法比较多,写一个个人觉得比较好用的
(C++/C)
#include <stdio.h>
#include <time>
time_t now;
struct tm time_now;
now = time(NULL);
localtime_r(&now, &time_now);
char entire[30];
strftime(entire, 30, "%Y.%B%d.%H%M", &time_now);
std::cout<<entire<<std::endl;
结果为: 2011.February14.1619
补个tm的结构:
struct tm { int tm_sec; int tm_min; int tm_hour; int tm_mday; int tm_mon; int tm_year; int tm_wday; int tm_yday; int tm_isdst; };
返回的字符串可以依下列的格式而定: %a 星期几的缩写。 %A 星期几的全名。 %b 月份名称的缩写。 %B 月份名称的全名。 %c 本地端日期时间较佳表示字符串。 %d 用数字表示本月的第几天 (范围为 00 至 31)。日期 %H 用 24 小时制数字表示小时数 (范围为 00 至 23)。 %I 用 12 小时制数字表示小时数 (范围为 01 至 12)。 %j 以数字表示当年度的第几天 (范围为 001 至 366)。 %m 月份的数字 (范围由 1 至 12)。 %M 分钟。 %p 以 ''AM'' 或 ''PM'' 表示本地端时间。 %S 秒数。 %U 数字表示为本年度的第几周,第一个星期由第一个周日开始。 %W 数字表示为本年度的第几周,第一个星期由第一个周一开始。 %w 用数字表示本周的第几天 ( 0 为周日)。 %x 不含时间的日期表示法。 %X 不含日期的时间表示法。 %y 二位数字表示年份 (范围由 00 至 99)。 %Y 完整的年份数字表示,即四位数。 %Z(%z) 时区或名称缩写。 %% % 字符。