This does seem to be a bit vague. Here is a useful tip and in this case I am using the korn shell. The idea here is to temporarily define the TZ environment variable; that is....
would define the TZ var for the execution of the date command...regardless of what the default TZ setting is.
By example...
This isn't a ksh feature, it is standard behavior required for any shell conforming to the POSIX standards or the Single UNIX Specifications. But, the format shown above is not correct. A valid setting for TZ will include at least the zone's name and offset from UTC. The normal setting for Texas in the United States would be TZ=CST6CDT (not TZ=CDT) and TZ=UTC happens to work because the offset from UTC to UTC is 0, but the output from the commands:
will be identical except for the difference in the time zone name. Compare the results above with:
where you'll see a 6 hour difference in time (this time of year) as well as a difference in the time zone name. The output from the above three commands should be something like:
Last edited by Don Cragun; 12-11-2013 at 08:20 PM..
Reason: Fix typo.
I have a list of interfaces and time the interface was last active. I can't figure out how to convert the time in the second column,
Fa1/14 0
Se0/0/0 0
Fa1/11 0
Fa1/9 0
Fa1/0 0
Se0/0/1 1240401408
Gi1/0 0
Fa0/0 1240401408
Fa1/3 0
Fa1/8 0
Fa1/15 0
Fa1/13 0
Fa1/10 0
Fa1/1 0
Fa1/12... (7 Replies)
Hi,
I need to convert a number representing time in UTC seconds to a date. Ex:
3BE0082C --> Oct 31 2001 15:31:08
I have tried the following perl command but it gives a different answer?
$ perl -e 'print scalar localtime(shift), "\n"' 3BE00B2C
Thu Jan 1 03:00:03 1970
Any ideas? Thanks. :) (10 Replies)
Hello,
Using AIX6.1 box.
I have UTC time value and need to convert it to local time value - I mean time zone and DST should be taken into consideration.
I hope it could be done using shell environment - I don't want to write a program.
thanks
Vilius
---------- Post updated at 02:30 PM... (2 Replies)
Hello All -
I have a script that grabs data from the net and outputs the following data
46029 46.144 -124.510 2010 07 26 22 50 320 4.0 6.0 2.2 9 6.8 311 1012.1 -0.9 13.3 13.5 13.3 - -
46041 47.353 -124.731 2010 07 26 22 50 250 2.0 3.0 1.6 8 6.4 - 1011.6 - ... (0 Replies)
Okay, so let's say we have a string like:
20110105_193345
This represents:
January 5th, 2011 = 20110105
24-hour style time 19:33:45 = 193345
Okay, so we have our time. It's January 5th, 2011 at 19:33:45. I want to convert this time from Eastern Time Zone (which it currently is in)... (1 Reply)
Hi,
A few days ago I changed my CentOS box's timezone to -07:00.
Now the date commands output look like this (run almost simultaneously, less than 1 second delay)..
# date
Mon Sep 5 20:23:40 PDT 2011
# date -u
Tue Sep 6 03:24:05 UTC 2011
The hours difference seems correct, but why is... (2 Replies)
I have a cluster of two Solaris server (veritas cluster). one working and the other is standby
I am going to change the date on them , and am looking for a secure solution as it is giving an important service.
my opinion is that the active one doesn't need to be restarted (if I don't change the... (1 Reply)
Hi Folks,
My server time is in EDT. And i am sending automated mails from that server in which i need to display the current date time as per IST (GMT+5:30). Please advice how to display the date time as per IST.
IST time leads 9:30 mins to EDT. and i wrote something like below.
... (6 Replies)
Hello AIX friends,
We have timezone settings on our AIX 6.1 boxes set to Europe/London.
How can I change it to UTC timezone with Daylight saving disabled.
After running "smit chtz_user" I don't see UTC option in the listing.
Please advise.
TIA (3 Replies)
hi,
my system date and time zone is PDT. whenever i append date time stamp to a file it appends the system date thats PDT date time zone. i want to append GMT time zone. is there a mechanism or option which can append the date time stamp according to GMT. (4 Replies)
Discussion started by: Little
4 Replies
LEARN ABOUT FREEBSD
adjkerntz
ADJKERNTZ(8) BSD System Manager's Manual ADJKERNTZ(8)NAME
adjkerntz -- adjust the local time CMOS clock to reflect time zone changes and keep the current timezone offset for the kernel
SYNOPSIS
adjkerntz -i
adjkerntz -a [-s]
DESCRIPTION
The adjkerntz utility maintains the proper relationship between the kernel clock, which is always set to UTC and the CMOS clock, which may be
set to local time. The adjkerntz utility also informs the kernel about machine timezone shifts in order to maintain proper timestamps for
local time file systems such as the MS-DOS file system. The main purpose of maintaining these timestamps properly is to keep the timestamps
of a FreeBSD MS-DOS file system and an MS-DOS operating system synchronized when they are installed on the same system rather than fixing
broken MS-DOS file timestamps. If the file /etc/wall_cmos_clock exists, it means that the CMOS clock keeps local time (MS-DOS and MS-Windows
compatible mode). If that file does not exist, it means that the CMOS clock keeps UTC time. The adjkerntz utility passes this state to the
machdep.wall_cmos_clock kernel variable.
Adjustments may be needed at system startup and shutdown, and whenever a time zone change occurs. To handle these different situations,
adjkerntz is invoked in two ways:
-i This form handles system startups and shutdowns. The adjkerntz utility is invoked with this option from /etc/rc on entry to multi-user
mode, before any other daemons have been started. The adjkerntz utility puts itself into the background. Then, for a local time CMOS
clock, adjkerntz reads the local time from it and sets the kernel clock to the corresponding UTC time. The adjkerntz utility also
stores the local time zone offset in the machdep.adjkerntz kernel variable, for use by subsequent invocations of 'adjkerntz -a' and by
local time file systems.
For a local time CMOS clock 'adjkerntz -i' pauses and remains inactive as a background daemon until it receives a SIGTERM. The SIGTERM
will normally be sent by init(8) when the system leaves multi-user mode (usually, because the system is being shut down). After
receiving the SIGTERM, adjkerntz reads the UTC kernel clock and updates the CMOS clock, if necessary, to ensure that it reflects the
current local time zone. Then adjkerntz exits.
-a [-s]
This form is used to update the local time CMOS clock and kernel machdep.adjkerntz variable when time zone changes occur, e.g., when
entering or leaving daylight savings time. The adjkerntz utility uses the kernel clock's UTC time, the previously stored time zone
offset, and the changed time zone rule to calculate a new time zone offset. It stores the new offset into the machdep.adjkerntz kernel
variable and updates the wall CMOS clock to the new local time. If 'adjkerntz -a' was started at a nonexistent time (during a timezone
change), it exits with a warning diagnostic unless the -s option was used, in which case adjkerntz sleeps 30 minutes and tries again.
This form should be invoked from root's crontab(5) every half hour between midnight and 5am, when most modern time zone changes occur.
Warning: do not use the -s option in a crontab(5) command line, or multiple 'adjkerntz -a' instances could conflict with each other.
The adjkerntz utility clears the kernel timezone structure and makes the kernel clock run in the UTC time zone. Super-user privileges are
required for all operations.
ENVIRONMENT
TZ Time zone change rule, see tzset(3); not needed when tzsetup(8) or zic(8) is used.
FILES
/etc/localtime Current zoneinfo file, see tzsetup(8) and zic(8).
/etc/wall_cmos_clock Empty file. Its presence indicates that the machine's CMOS clock is set to local time, while its absence indicates a
UTC CMOS clock.
DIAGNOSTICS
No diagnostics. If an error occurs, adjkerntz logs an error message via syslog(3) and exits with a nonzero return code.
SEE ALSO tzset(3), crontab(5), mount_msdosfs(8), rc(8), sysctl(8), tzsetup(8), zic(8)HISTORY
The adjkerntz utility appeared in FreeBSD 1.0.
AUTHORS
Andrey A. Chernov <ache@astral.msk.su>
BSD March 8, 2012 BSD