Path: utzoo!attcan!uunet!elroy.jpl.nasa.gov!ncar!asuvax!noao!arizona!dave From: dave@cs.arizona.edu (Dave P. Schaumann) Newsgroups: comp.lang.c Subject: Calculating cumulative constants (was Re: need "yy-ddd-hh:mm:ss ...) Message-ID: <968@caslon.cs.arizona.edu> Date: 27 Feb 91 20:24:45 GMT References: <368@bria> <1991Feb27.013021.5178@cc.helsinki.fi> Distribution: comp Organization: U of Arizona CS Dept, Tucson Lines: 20 In article <1991Feb27.013021.5178@cc.helsinki.fi> wirzenius@cc.helsinki.fi (Lars Wirzenius) writes: |int cumulative_yday[] = { | 0, /* days before Jan 1st */ | 0+31, /* Feb 1st */ | 0+31+28, /* March 1st */ | 0+31+28+31, /* April 1st */ | ... |}; How about enum { jan = 0, feb = jan+31, mar=feb+28, ... , dec=nov+30 } cum_days ; int cumulative_yday[] = { jan, feb, mar, ..., dec } ; -- Dave Schaumann dave@cs.arizona.edu 'Dog Gang'! Where do they get off calling us the 'Dog Gang'? I'm beginning to think the party's over. I'm beginning to think maybe we don't need a dog. Or maybe we need a *new* dog. Or maybe we need a *cat*! - Amazing Stories