On 2004-08-11 12:23, Mipam <[EMAIL PROTECTED]> wrote:
> On Wed, 11 Aug 2004, Giorgos Keramidas wrote:
> > On 2004-08-11 10:44, Mipam <[EMAIL PROTECTED]> wrote:
> > > #include
> > > #include
> > >
> > > int main()
> > > {
> > > struct tm *ptr;
> > > time_t tm;
> > > char str[60];
> > >
On Wed, 11 Aug 2004, Giorgos Keramidas wrote:
> On 2004-08-11 10:44, Mipam <[EMAIL PROTECTED]> wrote:
> > > You'd have to use strftime() and a local buffer for that.
> >
> > I found an example and adjusted it:
> >
> > #include
> > #include
> >
> > int main()
> > {
> > struct tm *ptr;
> >
On 2004-08-11 10:44, Mipam <[EMAIL PROTECTED]> wrote:
> > You'd have to use strftime() and a local buffer for that.
>
> I found an example and adjusted it:
>
> #include
> #include
>
> int main()
> {
> struct tm *ptr;
> time_t tm;
> char str[60];
> char str2[60];
> char str3[60
[SNIP]
> You'd have to use strftime() and a local buffer for that.
I found an example and adjusted it:
#include
#include
int main()
{
struct tm *ptr;
time_t tm;
char str[60];
char str2[60];
char str3[60];
tm = time(NULL)-86400;
ptr = localtime(&tm);
strftime(str ,100 , "%d",ptr);
strftime(st
On Tue, 10 Aug 2004, Giorgos Keramidas wrote:
> On 2004-08-10 18:45, Mipam <[EMAIL PROTECTED]> wrote:
> > #include
> > #include
> >
> > int main(void)
> > {
> > struct timeval tv;
> > struct timeval tv_current;
> > if (gettimeofday(&tv_current, NULL) == -1)
> >err(1, "Could not get local tim
On 2004-08-10 18:45, Mipam <[EMAIL PROTECTED]> wrote:
> #include
> #include
>
> int main(void)
> {
> struct timeval tv;
> struct timeval tv_current;
> if (gettimeofday(&tv_current, NULL) == -1)
>err(1, "Could not get local time of day");
> tv.tv_sec = tv_current.tv_sec-86400;
> printf("%s\n",
On 2004-08-10 18:45, Mipam <[EMAIL PROTECTED]> wrote:
> > Try calling ctime() with the address of tv.tv_sec:
> >
> > printf("%s\n", ctime(&tv.tv_sec));
>
> #include
> #include
>
> int main(void)
> {
> struct timeval tv;
> struct timeval tv_current;
> if (gettimeofday(&tv_current, NULL) ==
> Note that it's a good idea to explicitly specify that main() does
> nothing to its argument with:
>
> int
> main(void)
> {
> ...
> }
>
> and that main() has to `return' some value that fits in an `int' as its
> definition says it should.
>
> > Bu
On 2004-08-10 16:49, Mipam <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I tried to display the time from yesterday by this little program
>
> #include
> #include
>
> time_t tval;
>
> int main()
> {
> struct timeval tv;
> struct timeval tv_current;
>
> if (gettimeofday(&tv_current, NULL) == -1