473,405 Members | 2,262 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

How to implement my own ctime() in linux kernel?

Hi everyone!

I think that everyone knows ctime() in glibc:

The ctime(), gmtime() and localtime() functions all take an argument
of data type time_t which represents calendar time. When interpreted
as an absolute time value, it represents the number of seconds
elapsed since 00:00:00 on January 1, 1970, Coordinated Universal Time (UTC).

Now I need to use the function of ctime() in linux kernel, but it
seems that I cannot access ctime() in the linux kernel, right? So I have
to reimplement ctime() in the linux kernel. I found that the algorithm
of glibc ctime() is very complex, I don't understand it. Does anyone has
any good ideas about how to implement ctime()?

Thanks!
Nov 14 '05 #1
2 2940
Hao Xu <tr*******@vip.sina.com> writes:
I think that everyone knows ctime() in glibc:
Well, everyone here knows about the ctime() function defined by the C
standard.

[snip] Now I need to use the function of ctime() in linux kernel, but it
seems that I cannot access ctime() in the linux kernel, right?
No idea.
So I have to reimplement ctime() in the linux kernel. I found that
the algorithm of glibc ctime() is very complex, I don't understand
it. Does anyone has any good ideas about how to implement ctime()?


Not here. If you have a working implementation, you might be able to
just copy it into your code, whether you understand the algorithm or
not. If that doesn't work, you'll need to try a Linux-specific
programming group.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 14 '05 #2
On Mon, 16 Aug 2004 15:25:24 +0800, in comp.lang.c , Hao Xu
<tr*******@vip.sina.com> wrote:
Now I need to use the function of ctime() in linux kernel, but it
seems that I cannot access ctime() in the linux kernel, right?
No idea.
So I have
to reimplement ctime() in the linux kernel. I found that the algorithm
of glibc ctime() is very complex, I don't understand it.
Thats probably because it needs to be. I'd suggest you study the algo and
understand it...
Does anyone has
any good ideas about how to implement ctime()?


Ask in comp.unix.progammer. This is not a C question.
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 14 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: bouchia.nazha | last post by:
Hello I have encountered a problem using tomcat, linux and ssl. My problem seem to be a JVM memory deallocation problem on Linux. This is my configuration: OS: Redhat7.2 Tomcat: 4.0 Jdk:...
34
by: Maboroshi | last post by:
Hello My question has to do with python and linux - I was interested in finding out what it would take to reimplement the Linux Kernel in python basically just taking the source code from linux...
1
by: wukexin | last post by:
I write my own class Cfile, I want to know what about implement ctime().Who help me? My use function ctime, I sign it with $$$. my class Cfile: #------------------------ file.h...
3
by: Steven T. Hatton | last post by:
http://netlab.ru.is/exception/LinuxCXX.shtml We have implemented a complete kernel level run-time support for C++ in the Linux kernel. In particular our run-time support enables the full use of...
4
by: rahul8143 | last post by:
hello, I have some inline declaration questions. 1)why new kernel 2.4.30 has intermediate function of __ instead of direct calling it? int ip_finish_output(struct sk_buff *skb) { return...
31
by: arun | last post by:
I know it is a free compiler. But does it follow any standard? If so which standard is it? (Ansi, Ecma, etc?)
4
by: Pietro Cerutti | last post by:
Hi group, #include <stdio.h> #include <unistd.h> #include <time.h> int main(void) { time_t t1, t2; char *st1, *st2;
8
by: anchitgood | last post by:
Hey, I have developed a project on C++, but under windows. But we have got to run it in an open source (LINUX). Can anyone tell me what features of C++ are not supported in Linux ? Like i have...
16
by: Blubaugh, David A. | last post by:
To All, I was wondering if anyone has come across the issue of not being allowed to have the following within a Python script operating under Linux: time.sleep(0.0125) It appears that I...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.