Re: Planner-list today



On Mon, Jul 07, 2008 at 04:00:00PM +0400, Евгений Косов wrote:
> Is that what you need?
Yes, that was very helpful.

I am interested to know what output the attached code would produce on
your system.

Execute the following commands to compile and run it:

	gcc -o timetest timetest.c
	./timetest

Regards,
Maurice.

-- 
Maurice van der Pot

Gentoo Linux Developer   griffon26 gentoo org    http://www.gentoo.org
Gnome Planner Developer  griffon26 kfk4ever com  http://live.gnome.org/Planner

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main()
{
  time_t t1;
  struct tm *tm;
  long t2;

  t1 = time(NULL);
  printf("t1 = %ld\n", t1);

  tm = localtime(&t1);

  printf("tm_sec = %d\n", tm->tm_sec);
  printf("tm_min = %d\n", tm->tm_min);
  printf("tm_hour = %d\n", tm->tm_hour);
  printf("tm_mday = %d\n", tm->tm_mday);
  printf("tm_mon = %d\n", tm->tm_mon);
  printf("tm_year = %d\n", tm->tm_year);
  printf("tm_wday = %d\n", tm->tm_wday);
  printf("tm_yday = %d\n", tm->tm_yday);
  printf("tm_isdst = %d\n", tm->tm_isdst);

  setenv("TZ", "UTC", 1);
  t2 = mktime(tm);
  printf("t2 = %ld\n", t2);

  return 0;
}

Attachment: pgpYLDD99DEnY.pgp
Description: PGP signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]