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


C++ CTime::GetTimeT方法代码示例

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


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

示例1: x_SyncWithDir

void CLDS_File::x_SyncWithDir(const string& path,
                              CLDS_Set*     deleted,
                              CLDS_Set*     updated,
                              set<string>*  scanned_files,
                              TFlags        flags)
{
    CDir dir(path);
    if (!dir.Exists()) {
        LOG_POST_X(2, Info << "LDS: Directory is not found or access denied:" << path);
        return;
    } else {
        LOG_POST_X(3, Info << "LDS: scanning " << path);
    }

    CLDS_Query lds_query(m_DataBase);
    CChecksum checksum(CChecksum::eCRC32);


    // Scan the directory, compare it against File table
    // Here I intentionally take only files, skipping sub-directories,
    // Second pass scans for sub-dirs and implements recursion

    bool compute_check_sum =
        (flags & CLDS_Manager::fControlSumMask) == CLDS_Manager::fComputeControlSum;

    {{

    CDir::TEntries  content(dir.GetEntries());
    ITERATE(CDir::TEntries, i, content) {
        if (!(*i)->IsFile()) {
            continue;
        }
        (*i)->DereferenceLink();

        CTime modification;
        string entry = (*i)->GetPath();
        string name = (*i)->GetName();
        string ext = (*i)->GetExt();
        (*i)->GetTime(&modification);
        time_t tm = modification.GetTimeT();
        CFile aFile(entry);
        Int8 file_size = aFile.GetLength();

        if (ext == ".db" || ext == ".idx") {
            continue; // Berkeley DB file, no need to index it.
        }

        bool found = lds_query.FindFile(entry);

        scanned_files->insert(entry);

        if (!found) {  // new file arrived
            CFormatGuess fg;

            Uint4 crc = 0;

            if (compute_check_sum) {
                checksum.Reset();
                ComputeFileChecksum(entry, checksum);
                crc = checksum.GetChecksum();
            }

            CFormatGuess::EFormat format = fg.Format(entry);

            FindMaxRecId();
            ++m_MaxRecId;

            m_FileDB.file_id = m_MaxRecId;
            m_FileDB.file_name = entry.c_str();
            m_FileDB.format = format;
            m_FileDB.time_stamp = tm;
            m_FileDB.CRC = crc;
            m_FileDB.file_size = file_size;

            m_FileDB.Insert();

            m_DataBase.GetTables().file_filename_idx.file_id = m_MaxRecId;
            m_DataBase.GetTables().file_filename_idx.file_name = entry.c_str();
            m_DataBase.GetTables().file_filename_idx.UpdateInsert();

            updated->set(m_MaxRecId);

            LOG_POST_X(4, Info << "New LDS file found: " << entry);

            continue;
        }

        if (tm != m_FileDB.time_stamp || file_size != m_FileDB.file_size) {
            updated->set(m_FileDB.file_id);
            UpdateEntry(m_FileDB.file_id,
                        entry,
                        0,
                        tm,
                        file_size,
                        compute_check_sum);
        } else {

            Uint4 crc = 0;
            if (compute_check_sum) {
                checksum.Reset();
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


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