我正在设置一个 docker 容器,并且有两个地方设置了时区:
任何人都可以向我解释它们之间的区别以及两者的用途吗?
我有一个 Windows 应用程序(在 Wine 下),它仅在我将时区更改为纽约的时区时才有效。
与任何其他区域它不会启动!
那么,是否可以在 Linux 中运行时区与系统配置时区不同的应用程序?
我正在使用 Ubuntu 10.04
我正在尝试设置在不同时区运行的 cronjob。我用谷歌搜索了很多,发现编辑/etc/default/cron是要走的路。但是这个文件已被弃用,我看到以下消息,所以我TZ=IST在文件中添加了/etc/init/cron.conf. 我不确定这会奏效,请问有什么关于如何前进的提示吗?
# This file has been deprecated. Please add custom options for cron to
# /etc/init/cron.conf and/or /etc/init/cron.override directly. See
# the init(5) man page for more information
Run Code Online (Sandbox Code Playgroud)
我在 Ubuntu Linux 上使用 cron 3.0pl1-120ubuntu4。
我正在使用它来配置本地时间:
dpkg-reconfigure tzdata
Run Code Online (Sandbox Code Playgroud)
它是 ncurses 接口。我正在寻找编程的方法。没有用户 ncurses 界面有没有真正的方法?
如何通过一个 shell 命令更改本地时间?
可惜timedatectl set-timezone没有更新/etc/timezone。
我如何获得当前时区Region/City,例如,给定:
% timedatectl | grep zone
Time zone: Asia/Kuala_Lumpur (+08, +0800)
Run Code Online (Sandbox Code Playgroud)
我可以得到最后一部分:
% date +"%Z %z"
+08 +0800
Run Code Online (Sandbox Code Playgroud)
如何在Asia/Kuala_Lumpur不获得全部awk病房的情况下获得零件?
我在 Linux 上,但是还有 POSIX 方式吗?
我预计更改时区时timedatectl会更新,但没有:/etc/timezone
% sudo timedatectl set-timezone 'Asia/Kuala_Lumpur'
% cat /etc/timezone
Asia/Bangkok
Run Code Online (Sandbox Code Playgroud)
有没有理由不这样做?(漏洞?)
如果我手动更新/etc/timezone为 match timedatectl set-timezone,是否有我应该注意的副作用?
还有其他地方我应该考虑更改时区,例如xfce4 面板时钟吗?
我有一台运行 iOS 3.1.3 的 iPod touch(第 2 代)(因为它在 iOS 4 上性能不佳),并且当我将它连接到计算机时,时钟设置本身比实际时间提前一小时不断出现问题。
当我通过 SSH 连接到设备时:
date "+%Z"回报ARST是正确的(我在布宜诺斯艾利斯,阿根廷)date "+%z"结果是-0200,这是错误的,应该是-0300我的问题是:如何将时区的偏移量更正为实际值?
我发现提到的zic,zdump并引用了“IANA时区数据库”。
我试图找到已编译的文件以替换整个“zoneinfo”文件夹,但我找到的下载似乎使用了与 iPod 上不同的文件夹结构。
编辑:我正在寻找一种编辑或更新时区信息的方法,以便正确配置我的时区“ARST”。我发现了几个对名为zic.
这两个zic和zdump存在的设备,我相信这会导致它可以通过SSH和UNIX命令来完成的。
我不希望我的系统使用夏令时。
root@ali-debserver:~# cat /etc/timezone
Asia/Tehran
root@ali-debserver:~# cat /etc/default/rcS
#
# /etc/default/rcS
#
# Default settings for the scripts in /etc/rcS.d/
#
# For information about these variables see the rcS(5) manual page.
#
# This file belongs to the "initscripts" package.
# delete files in /tmp during boot older than x days.
# '0' means always, -1 or 'infinite' disables the feature
#TMPTIME=0
# spawn sulogin during boot, continue normal boot if not used in 30 seconds
#SULOGIN=no
# do …Run Code Online (Sandbox Code Playgroud) 我注意到我的 GNOME 3 (Arch Linux) 的自动时区检测功能无法正常工作。我的实际时区是 PST (UTC-08),但是如果我在“所有设置 -> 日期和时间”中打开“自动时区”选项,它会检测到我在 EST (UTC-05)。
核心: 4.9.11-1-ARCH
侏儒: 3.22.3-1
的输出timedatectl:
Local time: Wed 2017-03-01 05:36:18 EST
Universal time: Wed 2017-03-01 10:36:18 UTC
RTC time: Wed 2017-03-01 10:36:18
Time zone: America/New_York (EST, -0500)
Network time on: yes
NTP synchronized: yes
RTC in local TZ: no
Run Code Online (Sandbox Code Playgroud)
输出sudo hwclock --show:(2017-03-01 05:37:38.295861-0500即当前 EST 时间)
的输出date:Wed Mar 1 05:39:07 EST 2017
我怀疑我的 IP 地址有问题,但是我尝试过的所有在线 IP 位置查找器网站都告诉我我在旧金山(这是正确的)。另外,我运行的是双系统(Windows 10 和 Arch),一个操作系统写入硬件时钟总是导致另一个操作系统在下次启动时时间不正确;我只是忽略它,让操作系统的互联网时间服务纠正它。错误时区检测直到今天才开始。 …
在我的 Manjaro linux 机器上,我有一个文件/etc/timezone,其中包含:
Asia/Bangkok
Run Code Online (Sandbox Code Playgroud)
另一个 Manjaro 论坛用户也有相同的文件。该线程总体上包含有关此问题的一些现有技术。
奇怪的是timedatectl status不使用这个文件来报告Region/City. 这是初始状态:
$ timedatectl status
Local time: Fri 2018-06-29 11:01:28 +07
Universal time: Fri 2018-06-29 04:01:28 UTC
RTC time: Fri 2018-06-29 04:01:28
Time zone: Asia/Bangkok (+07, +0700)
System clock synchronized: no
systemd-timesyncd.service active: no
RTC in local TZ: no
Run Code Online (Sandbox Code Playgroud)
现在我/etc/localtime用它指向的文件内容覆盖符号链接:
$ sudo ln -f "$(realpath /etc/localtime)" /etc/localtime
$ timedatectl status
Local time: Fri 2018-06-29 04:04:03 UTC
Universal time: Fri 2018-06-29 04:04:03 UTC …Run Code Online (Sandbox Code Playgroud)