Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 May 1998 21:11:10 -0700 (PDT)
From:      Gary Kline <kline@thought.org>
To:        freebsd-questions@FreeBSD.ORG (FreeBSD Mailing List)
Subject:   further locale questions...
Message-ID:  <199805070411.VAA23567@tao.thought.org>

next in thread | raw e-mail | index | archive | help

	Several days ago I asked if anyone could clue me in on 
	how our locale library worked.  Most of my code did nothing.

	Something like this (and thanks to Geoff Keating):


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

int main(void)
{
  time_t now;
  char buf[1000];
  struct tm brokendown;
  
  setlocale(LC_ALL, "");
  time(&now);
  brokendown = *localtime(&now);
  strftime(buf, sizeof(buf), "%c", &brokendown);
  printf("%s\n", buf);
  return 0;
}

	should do the following:

% env LANG=fr ./now
jeu  7 mai  98, 12:37:20 EST
% env LANG=en_AU ./now
Thu 07 May 1998 12:38:04 PM EST
% env LANG=C ./now
Thu May 07 12:38:16 1998

	But the 2.2.5 libc/locale libraries fail here.   If -hackers
	is a more appropriate place for this, please clue me in.
	At any rate, does anyone here know what going on?  Also,
	do we//should we have  `localedef' and `locale' utilities?

	From initial hacking it looks as though strftime.c is not
	making the LC_TIME data available to the environment.

	FWIW, FreeBSD seems to be ahead of the Net folks here.

	Clues anybody???

	gary

-- 
   Gary D. Kline         kline@tao.thought.org          Public service uNix


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199805070411.VAA23567>