当前位置: 首页>>代码示例>>C++>>正文


C++ BEntry::GetCreationTime方法代码示例

本文整理汇总了C++中BEntry::GetCreationTime方法的典型用法代码示例。如果您正苦于以下问题:C++ BEntry::GetCreationTime方法的具体用法?C++ BEntry::GetCreationTime怎么用?C++ BEntry::GetCreationTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BEntry的用法示例。


在下文中一共展示了BEntry::GetCreationTime方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: file

Shisen::Shisen():
	BApplication("application/x-vnd.KWS-BShisen")
{
system_info info;
union split sp;
app_info app;

#ifdef USE_YLANGUAGE
	Language.SetName("English");
	if (Language.InitCheck() != B_OK)
		printf("error loading language file (English\n");
		
	BuildLanguageList();
#endif

	REGISTERED = false;
	NAG = false;
	
	get_system_info(&info);get_system_info(&info);
	
//	if (info.id[0] && info.id[1]) // P3 ?
//	{
//		sp.i32[0] = info.id[0];
//		sp.i32[1] = info.id[1];
		KEY = sp.i64;
//	}
//	else	// make a KEY from the CPU TYPE & the speed
//	{
//		KEY = info.cpu_clock_speed;
//		KEY |= info.cpu_revision;
//	}
	
	// sanity check
	if (!KEY) KEY = 0xbebebebe;
	
	//printf("key is %lx\n", KEY);
	
	
	/*
	 * 1) Check the creation time
	 * 2) Check the last accessed time
	 * 3) subtract
	 * if > 3 days, nag++
	 */
	// check ~/config/settings/BShisen_prefs

	BPath path;
	BEntry entry;
	
	if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) == B_OK
		&& path.Append(PREFS_FILE_NAME, true) == B_OK
		&& entry.SetTo(path.Path(), true) == B_OK)
	{
		time_t t_t = 0;
		time_t c_t;
		
		if (entry.GetCreationTime(&c_t) == B_OK)
		{
			//ok, file exists.  Check the creation date & see if it was > 7 days ago
			t_t = (time_t)real_time_clock();
			
			if (t_t > c_t)
			{
				t_t -= c_t;
				
				// t_t == # of secs between when file was created & now
				
				if (t_t > 7 * 24 * 60 * 60) NAG = true;
			}
		}
	}	



#if 0	
	if (GetAppInfo(&app) == B_OK)
	{
		BEntry entry;
		struct stat st;
		time_t t_t;
		
		entry.SetTo(&app.ref, true);
		entry.GetStat(&st);
	
		t_t = st.st_atime - st.st_ctime;

		if (t_t > 5 * 24 * 60 * 60)
			NAG = true;
	}
#endif

	game = new GameWindow;
	game->Show();	
}
开发者ID:HaikuArchives,项目名称:BShisen,代码行数:94,代码来源:Shisen.cpp


注:本文中的BEntry::GetCreationTime方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。