473,789 Members | 2,648 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2956
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_Keit h) 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.proga mmer. 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
5888
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: 1.3.1_07
34
5098
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 and rewriting it in python Would this idea make sense to do - if so what would be the benefits of doing this and in what way would this not be a good idea Cheers
1
574
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 #--------------------------- #include <io.h> #include <ctime> #include <string>
3
3346
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 C++ exceptions in the Linux kernel, but notably also includes support for global constructors and destructors, and dynamic type checking. Our kernel level support is based on open source commodity components, specifically the GNU gcc/g++ compiler...
4
2700
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 __ip_finish_output(skb); } and also __ip_finish_output is written as
31
1813
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
3384
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
1696
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 heard Linux doesn't support esception handling and destructors. Similarly what about strings and other C++ features (say class, inheritance etc.) ? Thank you
16
1868
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 am not allowed to have the object sleep. Has anyone encountered this specific issue before in the past?
0
9663
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9506
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10404
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10193
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10136
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5548
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4089
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3695
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2906
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.