Download

Get real clock time

So for my brand new solid save system for UDK GOTA i want to add that the list of save games displays the realclocktime(time) on where you saved the game any idea?

In any object, you can call GetSystemTime(). That should get you everything you need.

here is the clock script from teg’s playground.
it works multiplayer and displays local time on a scripted texture
take from it what you will


class Clock_Actor extends Actor placeable;

var() int ConsoleMaterialIndex;
var() MaterialInterface ConsoleMaterialTemplate;
var() name CanvasTextureParamName;

var MaterialInstanceConstant ConsoleMaterial;
var ScriptedTexture CanvasTexture;
var() float ScrollAmount;
var() float TextScale;
var() LinearColor ClearColor;
var() Color TextColor;

var string ConsoleText;
var Vector2D Pos;

var() AudioComponent ChimeSound;
//the component
var ParticleSystemComponent Explosion;
//the actual particle systems
var() ParticleSystem ExplosionTemplate;

var int Year1, Month1, DayOfWeek1, Day1, Hour1, Min1, Sec1, MSec1;

var() editinline const StaticMeshComponent Mesh;

simulated function PostBeginPlay()
{
   super.PostBeginPlay();

   CanvasTexture = ScriptedTexture(class'ScriptedTexture'.static.Create(1024, 1024,, ClearColor));
   CanvasTexture.Render = OnRender;

   if(ConsoleMaterialTemplate != none)
   {
      ConsoleMaterial = Mesh.CreateAndSetMaterialInstanceConstant(ConsoleMaterialIndex);
      if(ConsoleMaterial != none)
      {
         ConsoleMaterial.SetParent(ConsoleMaterialTemplate);

         if(CanvasTextureParamName != '')
         {
            ConsoleMaterial.SetTextureParameterValue(CanvasTextureParamName, CanvasTexture);
         }
      }
   }

   //SetConsoleText();
   Pos.X = CanvasTexture.SizeX;
}

function SetConsoleText(string text)
{
   ConsoleText = text;
}

unreliable client function OnRender(Canvas C)
{
   local Vector2D TextSize;

   C.TextSize(ConsoleText, TextSize.X, TextSize.Y);
   TextSize *= TextScale;
   Pos.Y = (CanvasTexture.SizeY / 2) - (TextSize.Y / 2);
   Pos.X -= WorldInfo.DeltaSeconds * ScrollAmount;
   if(Pos.X < -TextSize.X)
   {
      Pos.X = CanvasTexture.SizeX;
   }

   C.SetOrigin(0,0);
   C.SetClip(CanvasTexture.SizeX + TextSize.X, CanvasTexture.SizeY + TextSize.Y);
   C.SetPos(Pos.X, Pos.Y);

   C.SetDrawColorStruct(TextColor);
   //get the time on this machine
   GetSystemTime(Year1, Month1, DayOfWeek1, Day1, Hour1, Min1, Sec1, MSec1);
   ConsoleText = Hour1$":"$Min1;

   //chime on the hour
   if (Min1 + Sec1 + MSec1 == 0)
   {
      Explosion = WorldInfo.MyEmitterPool.SpawnEmitter(ExplosionTemplate, Location,,);
      if ( ChimeSound != None )
    {
        ChimeSound.Play();
    }
   }

   C.DrawText(ConsoleText,, TextScale, TextScale);

   CanvasTexture.bNeedsUpdate = true;
}

defaultproperties
{
   ClearColor=(R=0.0,G=0.0,B=0.0,A=0.0)
   TextColor=(R=255,G=255,B=255,A=255)
   ScrollAmount=0.0
   TextScale=10.0

   Begin Object class=StaticMeshComponent Name=StaticMeshComp1
      StaticMesh=StaticMesh'dwStaticMeshes.Plane'
   End Object

   Mesh = StaticMeshComp1
   Components.Add(StaticMeshComp1)

   //explosion sound
    Begin Object Class=AudioComponent Name=ExplosionSoundComponent
        SoundCue=SoundCue'A_Vehicle_Cicada.SoundCues.A_Vehicle_Cicada_Explode'
    End Object
    ChimeSound=ExplosionSoundComponent
    Components.Add(ExplosionSoundComponent);

    ExplosionTemplate=ParticleSystem'FX_VehicleExplosions.Effects.PS_Vehicle_DamageImpact'

    bStatic=false
    bNoDelete=true
    RemoteRole=ROLE_SimulatedProxy
    bAlwaysRelevant=true
    bHidden=false
    NetUpdateFrequency=1.0
    bNetTemporary=false
    bUpdateSimulatedPosition=false
}