9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] /adm/timezone/EET is bad
@ 2009-09-28 13:33 yaroslav
  0 siblings, 0 replies; 2+ messages in thread
From: yaroslav @ 2009-09-28 13:33 UTC (permalink / raw)
  To: 9fans

Today I noticed my Plan 9 machine displayed time which is 1 hr past
surrounding world.  Digging around, I found that DST start/end dates
for Eastern-European Time (/adm/timezone/EET) for current year are
bad.  Those follow pre-1996 conventions for ending dates and does DST
switch 2 hours later.  For more information, see
http://en.wikipedia.org/wiki/European_Summer_Time.

Bundled program prints valid pair of dates for a given year in
1996-2099 range.

Yaroslav.


# To unbundle, run this file
echo eet.c
sed 's/.//' >eet.c <<'//GO.SYSIN DD eet.c'
-/* Calculates DST start/end dates for EET timezone on a year given on
-cmdline.  {8c eet.c && 8l eet.8 && 8.out} */
-#include <u.h>
-#include <libc.h>
-
-void
-main(int argc, char* argv[])
-{
-	int yr = 2009;
-	Tm tm[] = {{
-		.sec = 0,
-		.min = 0,
-		.hour = 1,
-		.mday = 0,
-		.mon = 2,
-		.year = 0,
-		.wday = 0,
-		.zone = "GMT",
-		.tzoff = 0
-	}, {
-		.sec = 0,
-		.min = 0,
-		.hour = 1,
-		.mday = 0,
-		.mon = 9,
-		.year = 0,
-		.wday = 0,
-		.zone = "GMT",
-		.tzoff = 0
-	}};
-
-	if(argc > 1)
-		yr = atoi(argv[1]);
-
-	tm[0].year = tm[1].year = (yr - 1900);
-	tm[0].mday = (31 - (5*yr/4 + 4) % 7);
-	tm[1].mday = (31 - (5*yr/4 + 1) % 7);
-	/* formulas are valid until 2099 */
-
-	print("%d %d\n", tm2sec(&tm[0]), tm2sec(&tm[1]));
-	exits(nil);
-}
//GO.SYSIN DD eet.c




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [9fans] /adm/timezone/EET is bad
       [not found] <<1209a838da1003845b874b8a9ca0b4b7@isd.dp.ua>
@ 2009-09-29  1:45 ` erik quanstrom
  0 siblings, 0 replies; 2+ messages in thread
From: erik quanstrom @ 2009-09-29  1:45 UTC (permalink / raw)
  To: 9fans

On Mon Sep 28 09:34:51 EDT 2009, yarikos@gmail.com wrote:
> Today I noticed my Plan 9 machine displayed time which is 1 hr past
> surrounding world.  Digging around, I found that DST start/end dates
> for Eastern-European Time (/adm/timezone/EET) for current year are
> bad.  Those follow pre-1996 conventions for ending dates and does DST
> switch 2 hours later.  For more information, see
> http://en.wikipedia.org/wiki/European_Summer_Time.
>
> Bundled program prints valid pair of dates for a given year in
> 1996-2099 range.
>
> Yaroslav.

that's pretty nifty.  i wish i had gotten my code that small.
i don't have formulae that compact.  when i generated us
time zones, i took the more intuitive approach of using
command lines like "dateof 2009 mar sun 1" or "dateof 2009
mar sun last".  that way it was easy enough to encode the
appropriate rules and generate tz files directly.

i dusted that stuff off and added eet.  the zones generated
for the us will be different by 1hr in the fall for 2007-.  repeat
2:00-3:00, not 1:00-2:00.

/n/sources/contrib/quanstro/timezone

i noticed that the system's eet starts in 1986 not 1977
as i think it should.  am i wrong?  i'm not an eet expert.

- erik



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-09-29  1:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-28 13:33 [9fans] /adm/timezone/EET is bad yaroslav
     [not found] <<1209a838da1003845b874b8a9ca0b4b7@isd.dp.ua>
2009-09-29  1:45 ` erik quanstrom

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).