From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <96076332421510.tru64-unix-managers.marc@archive.invalid> From: Daniel.Clar () supelec ! fr (Daniel Clar) Date: Fri, 24 May 1996 15:28:49 +0000 To: tru64-unix-managers Subject: SUMMARY : Strange things with date command X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=96076332421510 The original posting was : > I was using the date command in many files to get some information. Today, > I've seen that my command files were not working any more and I've > discovered that date command has now a new field in the 6th position. It's > DST. > > Thu May 23 13:29:38 MET DST 1996 > > In fact, it seems to me that it was working before the change, but it's not > written in the man pages that the format should change with Daylight Saving > Time. > > I'm running 3.2c. IS it a bug or a feature ? Does it come from the patch for > leap year ? Thank you for their answers to : olle@cb.uu.se (Olle Eriksson) Steffen Kluge If you need to rely on the output format, e.g. in scripts, you should better use the `+field_description' switch. For example to produce output without time zone: date +"%a %b %d %H:%M:%S %Y" which gives something like: Thu May 23 15:24:50 1996 If you need the timezone info and want it to be a single field, regardless of whether daylight saving is active or not, you can change your timezone's name. In /etc/zoneinfo/sources/europe the is a line like: Rule M-Eur 1986 max - Mar lastSun 2:00s 1:00 " DST" You may change this line to: Rule M-Eur 1986 max - Mar lastSun 2:00s 1:00 "MEST" Another line, like Zone MET 1:00 M-Eur MET%s refers (with %s) to the last field of your above line. If you change it to: Zone MET 1:00 M-Eur %s you've changed your timezone reading during summer from `MET DST' to `MEST'. Rember to chdir to /etc/zoneinfo and do a `zic sources/europe' to implement you changes. --------------------- Dr. Thomas P. Blinn tpb@zk3.dec.com The problem may well be that the date command outputs 6 things, and one of those things happens, in your locale, when it's daylight savings time, to be a character string with an embedded space. If you treat spaces as delimiters for fields, then you'll think this is 7 fields, not 6, and I can see why you'd write shell scripts and the like that work that way. I would do that myself, and be surprised when it broke. Look at man 3 timezone and you'll see the explanation of how the stuff works. Then go look at /etc/zoneinfo/sources/europe. You'll see that in that file there is a string " DST" that gets appended to the base timezone name when daylight savings time is in effect. I just went back and checked the V3.0 sources, and that file hasn't changed since V3.0. I don't know how old it really is. It's possible that there was a libc bug in the date display routines that made them not correctly append the " DST" string when summer time was in effect, and that that bug just got fixed. What I'm suggesting is that it's working the way it always was supposed to work, and that your expectation about how it works is mistaken. However, if you want it to work differently, you can probably change your copy of /etc/zoneinfo/sources/europe to make, for instance, " DST" be just "_DST" and *maybe* after recompiling it you'd get a display of "MET_DST" as the string, instead of "MET DST". ---------------------------- Mandell Degerness MDEGERNESS@galaxy.gov.bc.ca The unformatted output of the date command is notorious for changing. I recommend you format the output: % date +'%Y%m%d' 19960523 % date +'%A %B %d, %Y' Thursday May 23, 1996 (See man page for details) ----------------------- Lucien_HERCAUD@paribas.com It was in French ! Daniel o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o | Daniel Clar e-mail : Daniel.Clar@supelec.fr | | Computer Operations Manager : dc@supelec.fr | | Service Informatique Supelec and | | Plateau de Moulon DECUSF::CLAR_D or clar_d@decus.fr | | 91192 Gif sur Yvette Cedex - France | | Tel : (33 1) 69 85 14 87 Fax : (33 1) 69 85 12 34 | o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o