public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Getting system time in kernel..
@ 2001-10-02  9:14 MOHAMMED AZAD
  2001-10-02  9:43 ` David Woodhouse
  0 siblings, 1 reply; 7+ messages in thread
From: MOHAMMED AZAD @ 2001-10-02  9:14 UTC (permalink / raw)
  To: Linux-Kernel (E-mail)

Hi all,

Any idea how to get the system time in a kernel module.... I tried this in
solaris... but i am getting only the GMT (that too elapsed time) how do i
convert this to my locale time.... 

TIA
azad

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Getting system time in kernel..
  2001-10-02  9:14 Getting system time in kernel MOHAMMED AZAD
@ 2001-10-02  9:43 ` David Woodhouse
  2001-10-03  5:01   ` David Schwartz
  0 siblings, 1 reply; 7+ messages in thread
From: David Woodhouse @ 2001-10-02  9:43 UTC (permalink / raw)
  To: MOHAMMED AZAD; +Cc: Linux-Kernel (E-mail)


mohammedazad@nestec.net said:
>  Any idea how to get the system time in a kernel module.... I tried
> this in solaris... but i am getting only the GMT (that too elapsed
> time) how do i convert this to my locale time....  

You can't. You shouldn't need to convert to localtime inside the kernel. 
What, precisely, are you trying to achieve?

--
dwmw2



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Getting system time in kernel..
  2001-10-02  9:43 ` David Woodhouse
@ 2001-10-03  5:01   ` David Schwartz
  2001-10-03  5:09     ` Keith Owens
  2001-10-03  8:33     ` Kai Henningsen
  0 siblings, 2 replies; 7+ messages in thread
From: David Schwartz @ 2001-10-03  5:01 UTC (permalink / raw)
  To: dwmw2, MOHAMMED AZAD; +Cc: Linux-Kernel



On Tue, 02 Oct 2001 10:43:23 +0100, David Woodhouse wrote:

>mohammedazad@nestec.net said:

>> Any idea how to get the system time in a kernel module.... I tried  this
>>in solaris... but i am getting only the GMT (that too elapsed  time) how do
>>i convert this to my locale time....  

>You can't. You shouldn't need to convert to localtime inside the kernel.
>What, precisely, are you trying to achieve?

	As an example, a filesystem might internally store local times in its 
inodes. You may not be free to change the on-disk format.

	DS



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Getting system time in kernel..
  2001-10-03  5:01   ` David Schwartz
@ 2001-10-03  5:09     ` Keith Owens
  2001-10-03  6:31       ` David Schwartz
  2001-10-03  8:33     ` Kai Henningsen
  1 sibling, 1 reply; 7+ messages in thread
From: Keith Owens @ 2001-10-03  5:09 UTC (permalink / raw)
  To: David Schwartz; +Cc: Linux-Kernel

On Tue, 2 Oct 2001 22:01:41 -0700, 
David Schwartz <davids@webmaster.com> wrote:
>	As an example, a filesystem might internally store local times in its 
>inodes. You may not be free to change the on-disk format.

Whose local time?  The local time where the machine is or the local
time of the user accessing the machine from the other side of the
world?  There is a very good reason why timestamps are GMT (UTC).


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Getting system time in kernel..
  2001-10-03  5:09     ` Keith Owens
@ 2001-10-03  6:31       ` David Schwartz
  2001-10-03  9:18         ` David Woodhouse
  0 siblings, 1 reply; 7+ messages in thread
From: David Schwartz @ 2001-10-03  6:31 UTC (permalink / raw)
  To: kaos; +Cc: Linux-Kernel


On Wed, 03 Oct 2001 15:09:32 +1000, Keith Owens wrote:
>On Tue, 2 Oct 2001 22:01:41 -0700,
>David Schwartz <davids@webmaster.com> wrote:

>>    As an example, a filesystem might internally store local times in its
>>inodes. You may not be free to change the on-disk format.

>Whose local time?  The local time where the machine is or the local time of
>the user accessing the machine from the other side of the world?  There is a
>very good reason why timestamps are GMT (UTC).

	Well that's an argument in favor of two things:

	1) Avoiding such situations whenever possible by using UTC timestamps in 
things like filesystems, and

	2) Making local time offsets tuneable for each case where you need one. The 
physical location of the machine might or might not be meaningful.

	DS





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Getting system time in kernel..
  2001-10-03  5:01   ` David Schwartz
  2001-10-03  5:09     ` Keith Owens
@ 2001-10-03  8:33     ` Kai Henningsen
  1 sibling, 0 replies; 7+ messages in thread
From: Kai Henningsen @ 2001-10-03  8:33 UTC (permalink / raw)
  To: linux-kernel

davids@webmaster.com (David Schwartz)  wrote on 02.10.01 in <20011003050142.AAA10921@shell.webmaster.com@whenever>:

> On Tue, 02 Oct 2001 10:43:23 +0100, David Woodhouse wrote:
>
> >mohammedazad@nestec.net said:
>
> >> Any idea how to get the system time in a kernel module.... I tried  this
> >>in solaris... but i am getting only the GMT (that too elapsed  time) how
> >>do i convert this to my locale time....
>
> >You can't. You shouldn't need to convert to localtime inside the kernel.
> >What, precisely, are you trying to achieve?
>
> 	As an example, a filesystem might internally store local times in its
> inodes. You may not be free to change the on-disk format.

Such as FAT and derived filesystems?

That's why Linux has sys_tz. Though I think that a mount option to  
override that might have been wise.

MfG Kai

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Getting system time in kernel..
  2001-10-03  6:31       ` David Schwartz
@ 2001-10-03  9:18         ` David Woodhouse
  0 siblings, 0 replies; 7+ messages in thread
From: David Woodhouse @ 2001-10-03  9:18 UTC (permalink / raw)
  To: David Schwartz; +Cc: kaos, Linux-Kernel


davids@webmaster.com said:
> 
> 	2) Making local time offsets tuneable for each case where you need
> one. The  physical location of the machine might or might not be
> meaningful.

Indeed. So you make the GMT offset a mount-time parameter for your 
filesystem, and the question of how to find the current localtime in the 
part of the world where the machine's primary console happens to stick out 
remains meaningless.


--
dwmw2



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2001-10-03 10:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-10-02  9:14 Getting system time in kernel MOHAMMED AZAD
2001-10-02  9:43 ` David Woodhouse
2001-10-03  5:01   ` David Schwartz
2001-10-03  5:09     ` Keith Owens
2001-10-03  6:31       ` David Schwartz
2001-10-03  9:18         ` David Woodhouse
2001-10-03  8:33     ` Kai Henningsen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox