Bug 44975 - Timer event stops occurring when time is changed using 'date' command in ubuntu
Summary: Timer event stops occurring when time is changed using 'date' command in ubuntu
Status: RESOLVED FIXED
Alias: None
Product: Installers
Classification: Mono
Component: General ()
Version: 4.2.0 (C6)
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Rodrigo Kumpera
URL:
Depends on:
Blocks:
 
Reported: 2016-10-03 12:13 UTC by meter
Modified: 2017-05-16 16:23 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
source code (1008 bytes, text/plain)
2016-10-03 12:13 UTC, meter
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description meter 2016-10-03 12:13:58 UTC
Created attachment 17847 [details]
source code

Below is the code which prints current time  every 2 two seconds. When time is drifted backwards by an hour using 
date -s "<intended time date>" 
prints stops coming (print message is not important -- code is running in monodevelop v5.10 on ubuntu 14.04 LTS).

This happens also when you drift time forward for many hours, with the same previous command.

 In Visual Studio 2012 (running on windows 7), this code prints messages every two seconds regardless of time drift.



using System;
using System.Timers;

public class Example
{
	private static System.Timers.Timer aTimer;
	public static void Main()
	{
		SetTimer();
		Console.WriteLine("\nPress the Enter key to exit the application...\n");
		Console.WriteLine("The application started at {0:HH:mm:ss.fff}", DateTime.Now);
		Console.ReadLine();
		aTimer.Stop();
		aTimer.Dispose();
		Console.WriteLine("Terminating the application...");
	}
	private static void SetTimer()
	{
		// Create a timer with a two second interval.
		aTimer = new System.Timers.Timer(2000);
		// Hook up the Elapsed event for the timer. 
		aTimer.Elapsed += OnTimedEvent;
		aTimer.AutoReset = true;
		aTimer.Enabled = true;
	}
	private static void OnTimedEvent(Object source, ElapsedEventArgs e)
	{
		Console.WriteLine("The Elapsed event was raised at {0:HH:mm:ss.fff}", e.SignalTime);
	}
}
Comment 1 Alexander Köplinger [MSFT] 2017-05-16 16:23:18 UTC
This should be fixed with https://github.com/mono/mono/pull/4446