本文整理汇总了C++中FDateTime::ToString方法的典型用法代码示例。如果您正苦于以下问题:C++ FDateTime::ToString方法的具体用法?C++ FDateTime::ToString怎么用?C++ FDateTime::ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FDateTime
的用法示例。
在下文中一共展示了FDateTime::ToString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ToDateTimeZoneString
FString FDateTimeStructCustomization::ToDateTimeZoneString(const FDateTime& UTCDate)
{
const int32 DisplayTimezone = GetLocalTimezone();
const FDateTime LocalTime = ConvertTime(UTCDate, TIMEZONE_UTC, DisplayTimezone);
return FString::Printf(TEXT("%s %s%0.4d"), *LocalTime.ToString(), (DisplayTimezone >= 0 ? TEXT("+") : TEXT("")), DisplayTimezone);
}
示例2: StartQosPass
void FQosDatacenterStats::StartQosPass()
{
if (!bAnalyticsInProgress)
{
FDateTime UTCTime = FDateTime::UtcNow();
QosData.Timestamp = UTCTime.ToString();
StartTimer(QosData.SearchTime);
bAnalyticsInProgress = true;
}
}
示例3: AsDateTime
FText FText::AsDateTime( const FDateTime& DateTime, const EDateTimeStyle::Type DateStyle, const EDateTimeStyle::Type TimeStyle, const FString& TimeZone, const FCulturePtr& TargetCulture )
{
checkf(FInternationalization::Get().IsInitialized() == true, TEXT("FInternationalization is not initialized. An FText formatting method was likely used in static object initialization - this is not supported."));
return FText::FromString(DateTime.ToString(TEXT("%Y.%m.%d-%H.%M.%S")));
}
示例4: SaveCookedPackageAssetRegistry
// cooked package asset registry saves information about all the cooked packages and assets contained within for stats purposes
// in json format
bool FChunkManifestGenerator::SaveCookedPackageAssetRegistry( const FString& SandboxCookedRegistryFilename, const bool Append )
{
bool bSuccess = false;
for ( const auto& Platform : Platforms )
{
TSet<FName> CookedPackages;
// save the file
const FString CookedAssetRegistryFilename = SandboxCookedRegistryFilename.Replace(TEXT("[Platform]"), *Platform->PlatformName());
FString JsonOutString;
JsonWriter Json = TJsonWriterFactory<TCHAR, TPrettyJsonPrintPolicy<TCHAR> >::Create(&JsonOutString);
Json->WriteObjectStart();
Json->WriteArrayStart(TEXT("Packages"));
for ( const auto& Package : AllCookedPackages )
{
Json->WriteObjectStart(); // unnamed package start
const FName& PackageName = Package.Key;
const FString& SandboxPath = Package.Value;
CookedPackages.Add( PackageName );
FString PlatformSandboxPath = SandboxPath.Replace(TEXT("[Platform]"), *Platform->PlatformName());
FDateTime TimeStamp = IFileManager::Get().GetTimeStamp( *PlatformSandboxPath );
Json->WriteValue( "SourcePackageName", PackageName.ToString() );
Json->WriteValue( "CookedPackageName", PlatformSandboxPath );
Json->WriteValue( "CookedPackageTimeStamp", TimeStamp.ToString() );
Json->WriteArrayStart("AssetData");
for (const auto& AssetData : AssetRegistryData)
{ // Add only assets that have actually been cooked and belong to any chunk
if (AssetData.ChunkIDs.Num() > 0 && (AssetData.PackageName == PackageName))
{
Json->WriteObjectStart();
// save all their infos
Json->WriteValue(TEXT("ObjectPath"), AssetData.ObjectPath.ToString() );
Json->WriteValue(TEXT("PackageName"), AssetData.PackageName.ToString() );
Json->WriteValue(TEXT("PackagePath"), AssetData.PackagePath.ToString() );
Json->WriteValue(TEXT("GroupNames"), AssetData.GroupNames.ToString() );
Json->WriteValue(TEXT("AssetName"), AssetData.AssetName.ToString() );
Json->WriteValue(TEXT("AssetClass"), AssetData.AssetClass.ToString() );
Json->WriteObjectStart("TagsAndValues");
for ( const auto& Tag : AssetData.TagsAndValues )
{
Json->WriteValue( Tag.Key.ToString(), Tag.Value );
}
Json->WriteObjectEnd(); // end tags and values object
Json->WriteObjectEnd(); // end unnamed array object
}
}
Json->WriteArrayEnd();
Json->WriteObjectEnd(); // unnamed package
}
if ( Append )
{
FString JsonInString;
if ( FFileHelper::LoadFileToString(JsonInString, *CookedAssetRegistryFilename) )
{
// load up previous package asset registry and fill in any packages which weren't recooked on this run
JsonReader Reader = TJsonReaderFactory<TCHAR>::Create(JsonInString);
TSharedPtr<FJsonObject> JsonObject;
bool shouldRead = FJsonSerializer::Deserialize(Reader, JsonObject) && JsonObject.IsValid() && JsonObject->HasTypedField<EJson::Array>(TEXT("Packages"));
if ( shouldRead )
{
TArray<TSharedPtr<FJsonValue>> PackageList = JsonObject->GetArrayField(TEXT("Packages"));
for (auto PackageListIt = PackageList.CreateConstIterator(); PackageListIt && shouldRead; ++PackageListIt)
{
const TSharedPtr<FJsonValue>& JsonValue = *PackageListIt;
shouldRead = JsonValue->Type == EJson::Object;
if ( shouldRead )
{
const TSharedPtr<FJsonObject>& JsonPackage = JsonValue->AsObject();
// get the package name and see if we have already written it out this run
FString CookedPackageName;
verify( JsonPackage->TryGetStringField(TEXT("SourcePackageName"), CookedPackageName) );
const FName CookedPackageFName(*CookedPackageName);
if ( CookedPackages.Contains(CookedPackageFName))
{
// don't need to process this package
continue;
}
// check that the on disk version is still valid
FString SourcePackageName;
check( JsonPackage->TryGetStringField( TEXT("SourcePackageName"), SourcePackageName) );
// if our timestamp is different then don't copy the information over
FDateTime CurrentTimeStamp = IFileManager::Get().GetTimeStamp( *CookedPackageName );
//.........这里部分代码省略.........