dyu@paul.rutgers.edu (Delong Yu) (03/01/90)
As you know, unix usee a long int to represent time(seconds from Jan 1, 1970) and there are some functions to convert this format to English-like format. But how to do the reverse conversion, anyone know some library function on AT&T SYSTEM V/386 or has any ideea how to do it?
daved@physiol.su.oz (Dave Davey) (03/03/90)
dyu@paul.rutgers.edu (Delong Yu) writes: >As you know, unix usee a long int to represent time(seconds from Jan >1, 1970) and there are some functions to convert this format to >English-like format. But how to do the reverse conversion, anyone I have added some code to a program called fdate that went out on the net years ago. The original program allowed you to print the current date in almost any format. I support a "-i date_string" input option as well as a "-r days_relative_to_today". This allows for answering questions in shellscripts like "what day of the month will it be in two days time" etc. I think my -i option will accept any unequivocal format I have ever seen or dreamt up. I'd be happy to distribute this code if I had the permission of the original author of fdate. Unfortunately I've lost track of who that was.
dave) (03/04/90)
In article <Mar.1.10.04.23.1990.25814@paul.rutgers.edu>, dyu@paul.rutgers.edu (Delong Yu) writes: > > As you know, unix usee a long int to represent time(seconds from Jan > 1, 1970) and there are some functions to convert this format to > English-like format. But how to do the reverse conversion, anyone > know some library function on AT&T SYSTEM V/386 or has any ideea how > to do it? I had to write the functions that you describe for a project I was working on. No one owns the rights to these functions, so if you want them just ask. Please keep in mind that these functions are accurate to the year 2452, after that they mess up. DAS -- David Snyder UUNET: dave@das13.UUCP (das13!dave) CIS: 74216,232 The ideal situation is to have real computing power close at hand - right at home. Something that dims streetlights and shrinks the picture on the neighbors TV when you crank it up.
decot@hpisod2.HP.COM (Dave Decot) (03/04/90)
In System V Release 4 (or any system that supports ANSI Standard C), the function mktime() accomplishes this. Dave Decot