找到你要的答案

Q:Programatically adjust Computer Time

Q:通过编程调整电脑时间

I am getting the GPS time from an external instrument.

I would like to set the windows computer time to that GPS time.

Does anyone know a command to manually change the Computer time ?

PS: It might also be interesting to know for unix machine.

我从一个外部仪器获取GPS时间。

我想设置Windows计算机时间到GPS时间。

有人知道命令手动更改计算机时间吗?

PS:也可以知道UNIX机器有趣。

answer1: 回答1:

You could use the system function. Depending on your operating system you'd have to change its arguments. For windows machine you have to set the date and the time separately:

changetime = 'time 6:22:07 AM';
changedate = 'date 11/30/2014';
system(changetime);
system(changedate);

Note that:

  • Time is in the HH:MM:SS AM/PM format;
  • Date is in the MM/DD/YYYY format.

For a unix machine:

changedatetime = 'sudo date 113006222014.07';
system(changedatetime)

Where the date is in the MMDDhhmmyyyy.ss format.

您可以使用系统功能。根据你的操作系统,你必须改变它的参数。对于Windows机器,您必须分别设置日期和时间:

changetime = 'time 6:22:07 AM';
changedate = 'date 11/30/2014';
system(changetime);
system(changedate);

请注意:

  • Time is in the HH:MM:SS AM/PM format;
  • Date is in the MM/DD/YYYY format.

对于UNIX机器:

changedatetime = 'sudo date 113006222014.07';
system(changedatetime)

那里的日期是在mmddhhmmyyyy.ss格式。

windows  matlab  unix  time  gps