Sponsored Content
Operating Systems Linux Strange, date and touch returning different times. Post 302411555 by markn86 on Thursday 8th of April 2010 10:13:35 PM
Old 04-08-2010
Hi Sysgate,

Thanks for your reply.

Below are the comments to your questions.

1) Timezone - /usr/share/zoneinfo/Australia/Brisbane

Like I said earlier, using date returns the correct time.

2) This is the output I received typing date then - Fri Apr 9 11:48:52 EST 2010 - UTC is EST. Is that what you were after? (I am no unix guru, I am a software engineer helping a client - not a system administrator)

3) I have read https://help.ubuntu.com/8.04/serverguide/C/NTP.html and not sure how this relates, as the time returned from date is correct, which uses NTP - doesn't it? I will suggest to the client that they add a cron job to run 'ntpdate ntp.ubuntu.com'.

4) Not sure - I was given a support account - which has given me permissions to create new files and browse. Do different users have different time configurations? The www-data user (web browser) is adding +18 hours to the time as well when a file is uploaded.

5) DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=8.04
DISTRIB_CODENAME=hardy
DISTRIB_DESCRIPTION="Ubuntu 8.04.2"

Regards,

Mark.

---------- Post updated at 09:13 PM ---------- Previous update was at 09:06 PM ----------

Also, I should add a quote I found when researching this issue on Linux Tips - Linux, Clocks, and Time - however we are not running Red Hat which is the distro the articles states that is affected - we however did follow the articles suggestion and created a symbolic link.

"..
The time in some applications is wrong

If some applications (such as date) display the correct time, but others don't, and you are running Red Hat Linux 5.0 or 5.1, you most likely have run into a bug caused by a move of the timezone information from /usr/lib/zoneinfo to /usr/share/zoneinfo. The fix is to create a symbolic link from /usr/lib/zoneinfo to /usr/share/zoneinfo: ``ln -s ../share/zoneinfo /usr/lib/zoneinfo''.
.."
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Strange "TOUCH" problem

On HPUX 11i, when using touch command to create a file 45mins old, I get the following error message: touch: cannot change times on /tmp/timestamp Any ideas??? cheers Bud (3 Replies)
Discussion started by: budrito
3 Replies

2. AIX

how would you know your server was rebooted 3 times or 5 times

Is there such location or command to know how many times did you reboot your server in that particular day?in AIX. (3 Replies)
Discussion started by: kenshinhimura
3 Replies

3. UNIX for Dummies Questions & Answers

Touch all files and subdirectories (recursive touch)

I have a folder with many subdirectories and i need to set the modified date to today for everything in it. Please help, thanks! I tried something i found online, find . -print0 | xargs -r0 touch but I got the error: xargs: illegal option -- r (5 Replies)
Discussion started by: glev2005
5 Replies

4. Shell Programming and Scripting

how to make a log.txt and add date and time when use ls,touch and find

Hey guy, how to make the log.txt file and record date and time when ls, touch and find command run? Thanks Boly (13 Replies)
Discussion started by: chenboly
13 Replies

5. Programming

Problem with implementing the times() function in C (struct tms times return zero/negative values)

Hello, i'm trying to implement the times() function and i'm programming in C. I'm using the "struct tms" structure which consists of the fields: The tms_utime structure member is the CPU time charged for the execution of user instructions of the calling process. The tms_stime structure... (1 Reply)
Discussion started by: g_p
1 Replies

6. Shell Programming and Scripting

Touch a file with creation date as 30 min past.

Hi All, I would like to create a file say test.txt. And the requirement is its creation date should be 30 minutes past. For Example : If i am creating a file at 2:00 am means. Creation time should be 01:30 am. likewise if i am creating a file at 5 pm means. Creation date should be... (5 Replies)
Discussion started by: Girish19
5 Replies

7. Red Hat

Touch - changing date and time

Hi, I am facing a problem with the command - TOUCH on Linux. See the example below: File on Linux: rw-rw-r-- user1 user1 Jan 01 09:00 test.txt The file - test.txt was created by the user - user1. Now, I want to change the date and time, but using other user - user2 The user2... (12 Replies)
Discussion started by: brjohnsmith
12 Replies

8. Shell Programming and Scripting

Strange behavior returning incorrect count

On AIX When I Run the commands below I get - cat tt11.ksh #!/bin/ksh ps -eaf |grep tt11.ksh|grep -v grep|wc -l count=`ps -eaf |grep tt11.ksh|grep -v grep|wc -l` echo "value of count is $count" Output (what I expected) ./tt11.ksh 1 value of count is 1 When I Run... (12 Replies)
Discussion started by: st11669
12 Replies

9. Shell Programming and Scripting

Bourne returning files based on creation date

I'm wanting to write a bourne shell script that takes in two command line arguments - a directory and a file. With this I want to return a list of files within the directory that are older (based on creation date) than the given file, and print the number of files that have not been listed (they... (4 Replies)
Discussion started by: britty4
4 Replies

10. Shell Programming and Scripting

Date: invalid date trying to set Linux date in specific format

i try to set linux date & time in specific format but it keep giving me error Example : date "+%d-%m-%C%y %H:%M:%S" -d "19-01-2017 00:05:01" or date +"%d-%m-%C%y %H:%M:%S" -d "19-01-2017 00:05:01" keep giving me this error : date: invalid date ‘19-01-2017 00:05:01' Please use CODE tags... (7 Replies)
Discussion started by: umen
7 Replies
TZSET(3)						   BSD Library Functions Manual 						  TZSET(3)

NAME
tzset -- initialize time conversion information LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <time.h> void tzset(void); DESCRIPTION
The tzset() function uses the value of the environment variable TZ to set time conversion information used by localtime(3). If TZ does not appear in the environment, the best available approximation to local wall clock time, as specified by the tzfile(5) format file /etc/localtime is used by localtime(3). If TZ appears in the environment but its value is a null string, Coordinated Universal Time (UTC) is used (without leap second correction). If TZ appears in the environment and its value is not a null string: - if the value begins with a colon, it is used as a pathname of a file from which to read the time conversion information; - if the value does not begin with a colon, it is first used as the pathname of a file from which to read the time conversion information, and, if that file cannot be read, is used directly as a specification of the time conversion information. When TZ is used as a pathname, if it begins with a slash, it is used as an absolute pathname; otherwise, it is used as a pathname relative to /usr/share/zoneinfo. The file must be in the format specified in tzfile(5). When TZ is used directly as a specification of the time conversion information, it must have the following syntax (spaces inserted for clar- ity): stdoffset[dst[offset][,rule]] where: std and dst Three or more bytes that are the designation for the standard (std) or summer (dst) time zone. Only std is required; if dst is missing, then summer time does not apply in this locale. Upper- and lowercase letters are explicitly allowed. Any characters except a leading colon (:), digits, comma (,), minus (-), plus (+), and ASCII NUL are allowed. offset Indicates the value one must add to the local time to arrive at Coordinated Universal Time. The offset has the form: hh[:mm[:ss]] The minutes (mm) and seconds (ss) are optional. The hour (hh) is required and may be a single digit. The offset following std is required. If no offset follows dst, summer time is assumed to be one hour ahead of standard time. One or more digits may be used; the value is always interpreted as a decimal number. The hour must be between zero and 24, and the minutes (and seconds) -- if present -- between zero and 59. If preceded by a ``-'' the time zone shall be east of the Prime Meridian; otherwise it shall be west (which may be indicated by an optional preceding ``+''). rule Indicates when to change to and back from summer time. The rule has the form: date/time,date/time where the first date describes when the change from standard to summer time occurs and the second date describes when the change back happens. Each time field describes when, in current local time, the change to the other time is made. The format of date is one of the following: Jn The Julian day n (1 <= n <= 365). Leap days are not counted; that is, in all years -- including leap years -- February 28 is day 59 and March 1 is day 60. It is impossible to explicitly refer to the occasional February 29. n The zero-based Julian day (0 <= n <= 365). Leap days are counted, and it is possible to refer to February 29. Mm.n.d The d'th day (0 <= d <= 6) of week n of month m of the year (1 <= n <= 5, 1 <= m <= 12, where week 5 means ``the last d day in month m'' which may occur in either the fourth or the fifth week). Week 1 is the first week in which the d'th day occurs. Day zero is Sunday. The time has the same format as offset except that no leading sign ``-'' or ``+'' is allowed. The default, if time is not given, is 02:00:00. If no rule is present in TZ, the rules specified by the tzfile(5) format file posixrules in /usr/share/zoneinfo are used, with the standard and summer time offsets from UTC replaced by those specified by the offset values in TZ. For compatibility with System V Release 3.1, a semicolon (;) may be used to separate the rule from the rest of the specification. If the TZ environment variable does not specify a tzfile(5) format file and cannot be interpreted as a direct specification, UTC is used. FILES
/etc/localtime local time zone file /usr/share/zoneinfo time zone information directory /usr/share/zoneinfo/posixrules used with POSIX-style TZ's /usr/share/zoneinfo/GMT for UTC leap seconds If /usr/share/zoneinfo/GMT is absent, UTC leap seconds are loaded from /usr/share/zoneinfo/posixrules. SEE ALSO
ctime(3), getenv(3), strftime(3), time(3), tzfile(5) STANDARDS
The tzset() function conforms to IEEE Std 1003.1-1988 (``POSIX.1''). BSD
April 1, 2001 BSD
All times are GMT -4. The time now is 12:35 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy