GetFormattedTimestamp() public method

public GetFormattedTimestamp ( ) : string
return string
Example #1
0
        public override void OnCreate()
        {
            base.OnCreate();
            Log.Info(TAG, "OnCreate: the service is initializing.");

            timestamper = new UtcTimestamper();
            handler     = new Handler();

            // This Action is only for demonstration purposes.
            runnable = new Action(() =>
            {
                if (timestamper == null)
                {
                    Log.Wtf(TAG, "Why isn't there a Timestamper initialized?");
                }
                else
                {
                    string msg = timestamper.GetFormattedTimestamp();
                    Log.Debug(TAG, msg);
                    Intent i = new Intent(Constants.NOTIFICATION_BROADCAST_ACTION);
                    i.PutExtra(Constants.BROADCAST_MESSAGE_KEY, msg);
                    Android.Support.V4.Content.LocalBroadcastManager.GetInstance(this).SendBroadcast(i);
                    handler.PostDelayed(runnable, Constants.DELAY_BETWEEN_LOG_MESSAGES);
                }
            });
        }
		public override void OnCreate()
		{
			base.OnCreate();
			Log.Info(TAG, "OnCreate: the service is initializing.");

			timestamper = new UtcTimestamper();
			handler = new Handler();

			// This Action is only for demonstration purposes.
			runnable = new Action(() =>
							{
								if (timestamper == null)
								{
									Log.Wtf(TAG, "Why isn't there a Timestamper initialized?");
								}
								else
								{
									string msg = timestamper.GetFormattedTimestamp();
									Log.Debug(TAG, msg);
									Intent i = new Intent(Constants.NOTIFICATION_BROADCAST_ACTION);
									i.PutExtra(Constants.BROADCAST_MESSAGE_KEY, msg);
									Android.Support.V4.Content.LocalBroadcastManager.GetInstance(this).SendBroadcast(i);
									handler.PostDelayed(runnable, Constants.DELAY_BETWEEN_LOG_MESSAGES);
								}
							});
		}
Example #3
0
 /// <summary>
 /// This method will return a formatted timestamp to the client.
 /// </summary>
 /// <returns>A string that details what time the service started and how long it has been running.</returns>
 string GetFormattedTimestamp()
 {
     return(timestamper?.GetFormattedTimestamp());
 }