Revision 3386 libsylph/utils.c

View differences:

utils.c
4315 4315
	return 0;
4316 4316
}
4317 4317

  
4318
time_t remote_tzoffset_sec(const gchar *zone)
4318
stime_t remote_tzoffset_sec(const gchar *zone)
4319 4319
{
4320 4320
	static gchar ustzstr[] = "PSTPDTMSTMDTCSTCDTESTEDT";
4321 4321
	gchar zone3[4];
......
4383 4383
	return remoteoffset;
4384 4384
}
4385 4385

  
4386
time_t tzoffset_sec(time_t *now)
4386
stime_t tzoffset_sec(stime_t *now)
4387 4387
{
4388
	time_t now_ = *now;
4388 4389
	struct tm gmt, *tmp, *lt;
4389 4390
	gint off;
4390 4391

  
4391
	tmp = gmtime(now);
4392
	tmp = gmtime(&now_);
4392 4393
	g_return_val_if_fail(tmp != NULL, -1);
4393 4394
	gmt = *tmp;
4394
	lt = localtime(now);
4395
	lt = localtime(&now_);
4395 4396
	g_return_val_if_fail(lt != NULL, -1);
4396 4397

  
4397 4398
	off = (lt->tm_hour - gmt.tm_hour) * 60 + lt->tm_min - gmt.tm_min;
......
4414 4415
}
4415 4416

  
4416 4417
/* calculate timezone offset (buf must not be less than 6 bytes) */
4417
gchar *tzoffset_buf(gchar *buf, time_t *now)
4418
gchar *tzoffset_buf(gchar *buf, stime_t *now)
4418 4419
{
4420
	time_t now_ = *now;
4419 4421
	struct tm gmt, *tmp, *lt;
4420 4422
	gint off;
4421 4423
	gchar sign = '+';
4422 4424

  
4423
	tmp = gmtime(now);
4425
	tmp = gmtime(&now_);
4424 4426
	g_return_val_if_fail(tmp != NULL, NULL);
4425 4427
	gmt = *tmp;
4426
	lt = localtime(now);
4428
	lt = localtime(&now_);
4427 4429
	g_return_val_if_fail(lt != NULL, NULL);
4428 4430

  
4429 4431
	off = (lt->tm_hour - gmt.tm_hour) * 60 + lt->tm_min - gmt.tm_min;
......
4450 4452
	return buf;
4451 4453
}
4452 4454

  
4453
gchar *tzoffset(time_t *now)
4455
gchar *tzoffset(stime_t *now)
4454 4456
{
4455 4457
	static gchar offset_string[6];
4456 4458

  

Also available in: Unified diff