From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <96079067215829.tru64-unix-managers.marc@archive.invalid> From: "Skeate, Scott B" Date: Thu, 05 Aug 1999 21:37:15 +0000 To: tru64-unix-managers Subject: SUMMARY [2]: edauth and coded dates X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=96079067215829 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--Boundary_(ID_eFrUi8F6QHkuzWZZemb5/A)" This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --Boundary_(ID_eFrUi8F6QHkuzWZZemb5/A) Content-type: text/plain Content-transfer-encoding: 7BIT Late entry... I haven't had a chance to look at these yet... but as Larry says, there is apparently demand for this type of thing. > ---------- > From: Larry Griffith > Sent: Thursday, August 05, 1999 5:26 PM > To: Skeate, Scott B > Subject: Re: edauth and coded dates > > <> <> > > I've searched the archives for this and can't find the answer. > > > > If I run edauth -g , I get a list of several things. > > I believe u_succchg#xxxxxxxxx: is the date of the last successful > password > > change. > > > > I believe this number is probably some time interval from some time/date > > combination. > > > > Does anyone know the what this number means? > > Does anyone have a script or other tool to easily convert it? > > It's the number of seconds since midnight January 1, 1970 (the > "base time" for UNIX). Here are two C programs that convert the > numeric time to an ordinary description and vice versa. I've sent > these out to a number of list subscribers; there apparently is quite a > demand for this. display_time.c is the one you requested; num_time.c is > the opposite conversion. > > Larry > > > ---------- > From: Skeate, Scott B > Sent: Thursday, August 05, 1999 5:28 PM > To: 'tru64-unix-managers@ornl.gov' > Subject: SUMMARY: edauth and coded dates > > Special thanks to: Pavel Krizka, Jim Fitzmaurice, and Gordon Lawson. > > The number is a time from the UNIX Epoch of 00:00:00 1/1/1970 (Which, by > the way, will die for 32 bit time keepers after 22:14:07 1/18/2038) > > Gordon provided the script and info below which does just what I need to > convert that time. > > /* Filename: /home/gordonl/toys/figure_time.c */ > > /* This program attempts to figure the time, given an argument in */ > > /* seconds since 1970. */ > > > > # include > > # include > > # include > > > > int main(int argc, char *argv[]) > > { > > int x; > > char *y; > > time_t *timer; > > > > if(argc < 2){ > > printf("Usage: %s number Where number is seconds past 1970\n", > argv[0]); > > printf("Remember that this is time based on GMT, i.e. -6 hours here > (Houston)\n"); > > exit(0); > > } > > /* > printf("%s %s\n", argv[0], argv[1]); > */ > > x = atoi(argv[1]); > timer = &x; > y = ctime(timer); > /* Same as y = asctime(localtime(timer)); */ > > printf("%s\n", y); > > return(0); > } /* main() */ > > This works, but I know it's not pretty... What do ya want for free?!? ;) > Compile with: cc figure_time.c -o figure_time > To use: figure_time number_to_convert > (You might want to change the usage message to your area...) > If you can't get it to work, let me know... I'm assuming you know at least > some programming, text editing, etc that a sys-admin knows. > > > > > > Original Question Below: > > ---------- > > From: Skeate, Scott B > > Sent: Thursday, August 05, 1999 3:37 PM > > To: 'tru64-unix-managers@ornl.gov' > > Subject: edauth and coded dates > > > > I've searched the archives for this and can't find the answer. > > > > If I run edauth -g , I get a list of several things. > > I believe u_succchg#xxxxxxxxx: is the date of the last successful > password > > change. > > > > I believe this number is probably some time interval from some time/date > > combination. > > > > Does anyone know the what this number means? > > Does anyone have a script or other tool to easily convert it? > > > > Thanks for your help. > > Scott Skeate > > scott.b.skeate@lmco.com > > > > > > --Boundary_(ID_eFrUi8F6QHkuzWZZemb5/A) Content-type: text/plain; name=num_time.c Content-disposition: attachment; filename=num_time.c Content-transfer-encoding: 7BIT #include #include #include int main() { struct tm input_time; char *buffer; int option; if ((buffer = (char *)malloc(80)) == NULL) { fprintf(stderr,"ERROR: Out of memory\n"); exit(4); } printf("\nPlease choose an option:\n\n"); printf("\t1) Current time\n"); printf("\t2) User-supplied time\n\n"); do { printf("Option by number --> "); fgets(buffer,80,stdin); } while ((sscanf(buffer,"%d",&option) != 1) || (option < 1) || (option > 2)); if (option == 1) printf("\nThe current time is %ld\n",time(NULL)); else { printf("\nPlease enter the following elements of the time:\n\n"); do { printf("Please enter the number of seconds (0-59) --> "); fgets(buffer,80,stdin); } while ((sscanf(buffer,"%d",&(input_time.tm_sec)) != 1) || (input_time.tm_sec < 0) || (input_time.tm_sec > 59)); do { printf("Please enter the number of minutes (0-59) --> "); fgets(buffer,80,stdin); } while ((sscanf(buffer,"%d",&(input_time.tm_min)) != 1) || (input_time.tm_min < 0) || (input_time.tm_min > 59)); do { printf("Please enter the number of hours (0-23) --> "); fgets(buffer,80,stdin); } while ((sscanf(buffer,"%d",&(input_time.tm_hour)) != 1) || (input_time.tm_hour < 0) || (input_time.tm_hour > 23)); do { printf("Please enter the day of the month (1-31) --> "); fgets(buffer,80,stdin); } while ((sscanf(buffer,"%d",&(input_time.tm_mday)) != 1) || (input_time.tm_mday < 1) || (input_time.tm_hour > 31)); do { printf("Please enter the month number (1-12) --> "); fgets(buffer,80,stdin); } while ((sscanf(buffer,"%d",&(input_time.tm_mon)) != 1) || (input_time.tm_mon < 1) || (input_time.tm_mon > 12)); input_time.tm_mon--; /* Must be 0 to 11 */ do { printf("Please enter the number of years since 1900 --> "); fgets(buffer,80,stdin); } while ((sscanf(buffer,"%d",&(input_time.tm_year)) != 1) || (input_time.tm_year < 0) || (input_time.tm_year > 199)); do { printf("Please enter 1 for Daylight time, 0 for Solar time --> "); fgets(buffer,80,stdin); } while ((sscanf(buffer,"%d",&(input_time.tm_isdst)) != 1) || (input_time.tm_isdst < 0) || (input_time.tm_isdst > 1)); /* Working here. Must determine the day of the week and the number of days since Jan 1. */ /* Experiment */ input_time.tm_wday = -1; input_time.tm_yday = -1; /* Invoke mktime and print result */ printf("The supplied time is %ld\n",mktime(&input_time)); } return 0; } --Boundary_(ID_eFrUi8F6QHkuzWZZemb5/A) Content-type: text/plain; name=display_time.c Content-disposition: attachment; filename=display_time.c Content-transfer-encoding: 7BIT #include #include #include int main(int argc, char *argv[]) { time_t the_time; if (argc < 2) { fprintf(stderr,"Usage: display_time number\n"); return 4; } the_time = (time_t)atol(argv[1]); printf("%s\n",asctime(localtime(&the_time))); return 0; } --Boundary_(ID_eFrUi8F6QHkuzWZZemb5/A)--