Ejemplo n.º 1
0
/*!
    \deprecated

    Returns the date and time when the file was created, the time its metadata
    was last changed or the time of last modification, whichever one of the
    three is available (in that order).

    This function is deprecated. Instead, use the birthTime() function to get
    the time the file was created, metadataChangeTime() to get the time its
    metadata was last changed, or lastModified() to get the time it was last modified.

    \sa birthTime(), metadataChangeTime(), lastModified(), lastRead()
*/
QDateTime QFileInfo::created() const
{
    QDateTime d = fileTime(QFile::FileBirthTime);
    if (d.isValid())
        return d;
    return fileTime(QFile::FileMetadataChangeTime);
}
Ejemplo n.º 2
0
void TProfiler::flushLogs() {
	for (int i = 0; i < 2; ++i) {
		QFile fileRo(_hashDir[i].absoluteFilePath(_output + ".ro"));
		if (!fileRo.open(QFile::WriteOnly)) {
			throw new std::runtime_error("Cann't write to output ro.");
		}
		QDataStream stream(&fileRo);
		stream << _ro[i];
		fileRo.close();

		QFile fileOver(_hashDir[i].absoluteFilePath(_output + ".over"));
		if (!fileOver.open(QFile::WriteOnly)) {
			throw new std::runtime_error("Cann't write to output over.");
		}
		stream.setDevice(&fileOver);
		stream << _over[i];
		fileOver.close();

		QFile fileTime(_hashDir[i].absoluteFilePath(_output + ".time"));
		if (!fileTime.open(QFile::WriteOnly)) {
			throw new std::runtime_error("Cann't write to output over.");
		}
		stream.setDevice(&fileTime);
		stream << _time[i];
		fileTime.close();
	}
}
Ejemplo n.º 3
0
std::string HDFSReadWrite::GetHdfsFileName(std::string iden) {
	boost::posix_time::ptime now =
			boost::posix_time::second_clock::local_time();
	std::string fileName;
	std::string fileTime(boost::posix_time::to_iso_string(now).substr(0, 11));
	fileName.append(fileTime + iden);

	return fileName;
}
Ejemplo n.º 4
0
StreamPtr HookSourceProvider::openInputStream(const SourceIdSPtr& pSourceId)
{
    std::time_t sourceTime = fileTime(pSourceId->value());
    if (mUpdateTime < sourceTime)
    {
        mBecauseOf = pSourceId->original();
        mUpdateTime = sourceTime;
    }
    return mSourceProvider->openInputStream(pSourceId);
}
Ejemplo n.º 5
0
void Directory::getFileInfo(StringMap &map) const
{
	// Note: fileInfo must not contain path
	
	map.clear();
	map["name"] =  fileName();
	map["time"] << fileTime();
	
	if(fileIsDir()) map["type"] =  "directory";
	else {
		map["type"] =  "file";
		map["size"] << fileSize();
	}
}
Ejemplo n.º 6
0
/*!
    Returns the date and local time when the file was last read (accessed).

    On platforms where this information is not available, returns the
    same as lastModified().

    \sa birthTime(), lastModified(), metadataChangeTime(), fileTime()
*/
QDateTime QFileInfo::lastRead() const
{
    return fileTime(QFile::FileAccessTime);
}
Ejemplo n.º 7
0
/*!
    Returns the date and local time when the file was last modified.

    \sa birthTime(), lastRead(), metadataChangeTime(), fileTime()
*/
QDateTime QFileInfo::lastModified() const
{
    return fileTime(QFile::FileModificationTime);
}
Ejemplo n.º 8
0
/*!
    \since 5.10
    Returns the date and time when the file metadata was changed. A metadata
    change occurs when the file is created, but it also occurs whenever the
    user writes or sets inode information (for example, changing the file
    permissions).

    \sa lastModified(), lastRead()
*/
QDateTime QFileInfo::metadataChangeTime() const
{
    return fileTime(QFile::FileMetadataChangeTime);
}
Ejemplo n.º 9
0
/*!
    \since 5.10
    Returns the date and time when the file was created / born.

    If the file birth time is not available, this function returns an invalid
    QDateTime.

    \sa lastModified(), lastRead(), metadataChangeTime()
*/
QDateTime QFileInfo::birthTime() const
{
    return fileTime(QFile::FileBirthTime);
}