TIP: Click on subject to list as thread! ANSI
echo: locsysop
to: Paul Edwards
from: Bob Lawrence
date: 1996-12-01 07:50:24
subject: posix

BL> Borland says the opposite about their stat struct, but
 BL> strftime() won't work in Unix anyway. I've had to write my own.
 BL> What I am trying

 PE> strftime() is ISO, and works under Unix.

  But strftime() won't work with time_t, you dickhead. It needs to be
broken down into the tm struct... which is the problem anyway. I love
the way it works... just move the problem along one.

  Now all I need is a function to turn the time_t long into a tm struct
which is what I worte for myself. I can use mktime() to do the opposite,
create the time_t struct from tm, but the book says that one won't work 
in UNIX either... or do I just ignore that? How much of the book can I 
ignore? Is there a standard for that too?

  So far, the book says stat() works for DOS/UNIX but is not ansi, ctime() 
in ansi and works for UNIX too, but strftime() and mktime() are ansi but 
don't work for UNIX. 

  As usual, K&R handles the easy part (size) but dances right around
time. I love this C language! 
 
 BL> timezone = 0;
 BL> daylight = 0;

 PE> Try setting the TZONE environment variable.

  I'm not worried about *me*, I'm worried about everyone else. It
seems that DOS comes preset to New York daylight saving. I don't want 
to write a program that only works if people know how to run it. I
want something bears can use... but it means I have to be smarter
than the average bear.

 BL> and then ctime() won't work!

 PE> Says who?

  I just said it. If I set the times to zero, ctime() (local time)
also has to be set to GMT or you get the wrong file date.

 PE> Anyway, to fix the New York thing, see if it uses the TZ
 PE> environment variable, ie try "set TZ=EST-10",

  ROFL!!! You have a weird idea of how to solve problems... just move
it along one.

  PE> you can use localtime() instead of gmtime()? 

  ctime *IS* localtime.

 BL> I love C. It's such a great language... and so portable, too.

 PE> It is. What are you comparing it to, BTW? Something which won't
 PE> even *compile* under Unix? 

  I am comparing it to what *you* said it was: a portable language
using standardised functions. Pity about the reality...

 BL> You used one too many brackets.

 PE> Read it again. BFN. Paul.

  Very clever...

  BTW, I was wrong about stat(). It works on a closed file and is
very useful. Pity it's not ansi, though...

Regards,
Bob
___ Blue Wave/QWK v2.12
@EOT:

---
* Origin: Precision Nonsense, Sydney (3:711/934.12)
SEEN-BY: 711/934 712/610
@PATH: 711/934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.