如何手动更改linux系统时间?

时间:2016-04-18 14:43:03

标签: linux date unix system-clock

我在VM中运行了Mint Linux。

我尝试通过GUI将日期设置为较早的日期,因此我可以尝试模拟在该日期生产时发生的数据库问题。

我尝试使用date命令。

两次都会在几秒钟内将日期更改回今天。

我停止自动时间同步 - 来自 protected override async void OnCreate (Bundle savedInstanceState) { base.OnCreate (savedInstanceState); SetContentView (Resource.Layout.austinBowlingAthletesList); EditText austinBowlingFullNameEntry = FindViewById<EditText> (Resource.Id.austinBowlingFullNameEntry); EditText austinBowlingEmailEntry = FindViewById<EditText> (Resource.Id.austinBowlingEmailEntry); Button austinBowlingSubmitButton = FindViewById<Button> (Resource.Id.austinBowlingSignUpButton); CloudStorageAccount storageaccount = CloudStorageAccount.Parse ("StorageConnectionString"); CloudTableClient tableClient = storageaccount.CreateCloudTableClient (); CloudTable austinBowlingAthletes = tableClient.GetTableReference ("austinBowlingAthletesTable"); await austinBowlingAthletes.CreateIfNotExistsAsync (); austinBowlingSubmitButton.Click += async (sender, e) => { austinBowlingAthlete austinBowlingAthlete1 = new austinBowlingAthlete(); austinBowlingAthlete1.fullname = austinBowlingFullNameEntry.ToString(); austinBowlingAthlete1.email = austinBowlingEmailEntry.ToString(); TableOperation insertOperation = TableOperation.Insert(austinBowlingAthlete1); await austinBowlingAthletes.ExecuteAsync(insertOperation); }; } 的输出是:

timedatectl status

我试过了:

    Local time: Mon 2016-04-18 15:41:19 BST
  Universal time: Mon 2016-04-18 14:41:19 UTC
        Timezone: Europe/London (BST, +0100)
     NTP enabled: no
NTP synchronized: no
 RTC in local TZ: no
      DST active: yes
 Last DST change: DST began at
                  Sun 2016-03-27 00:59:59 GMT
                  Sun 2016-03-27 02:00:00 BST
 Next DST change: DST ends (the clock jumps one hour backwards) at
                  Sun 2016-10-30 01:59:59 BST
                  Sun 2016-10-30 01:00:00 GMT

没有任何作用,时钟只会一直回到今天。

2 个答案:

答案 0 :(得分:1)

我觉得自己像个白痴。

我认为这是Linux或Mint魔法......愚蠢的我忘了它是一个虚拟机,所以它从主机那里得到了时间。

我手动更改主机上的时间,然后在VM中更改它。

Doh,发布答案以防其他人忘记了最明显的事情!

答案 1 :(得分:0)

我的第一个建议是检查您是否已启用自动时间和日期更新,如果是,则关闭该选项。我的机器上也发生了同样的事情,尽管我使用的是Debian。