Programming :: Get Epoch Time In Fraction?

Jun 10, 2011

get epoch time in high precision manner. You can take ref of wireshark gui, the packet arrival time. Its displayed in "1307691642.720358" manner.I mean in float. I need to get exactly the same thing. I know there is gettimeofday()/time() functions but they are returning INT time and not in float. What should I do ? (I am using fedora/kernel-2.6.18)

View 4 Replies


ADVERTISEMENT

Programming :: Convert A Given Date To Epoch Time And Vice Versa?

Jan 5, 2011

I'm developing a C++ application which is run on linux. I need to calculate epoch time for a given date and vice versa. (no of seconds elapsed since 1979-01-01) I used the following two methods.I need to convert the given date to epoch time and again convert that epoch time to the corresponding date.But the following methods doesn't give me the correct answer. Method to calculate the epoch time:

Code:

time_t HistoryCache::ConvertTimeToEpoc(const char* _zTime,const char* _zFormat)
{
struct tm tmTime;
strptime(_zTime,_zFormat, &tmTime);

[code]....

My problem is this. Lets think that the value I get as epoch time for the 2010-01-05:000000 is 1262649600. (lTime value) Then I use the same value (1262649600) as a input to the GetTimeStamp method, I didnt get the dateString as 2010-01-05:000000. The date is changed by one day.

View 2 Replies View Related

Programming :: Converting Epoch In A File Name To Human Readable Date/time?

May 5, 2011

I have log files that everyday are downloaded from my webserver in the format: Code: samplesite.com.xxxxxxxxxxx.gz xxxxxxxxxx is a 10 digit epoch time. I am trying to figure out a way in batch to:

1. find all of exisiting files containing the pattern (after the first run it will only be one a day)
2. Isolate the epoch string
3. convert the epoch string to human readable date/time
4. rename the original file as samplesite.com.mmddYYYY.gz

View 2 Replies View Related

Fedora :: Gnome Clock Applet And Epoch Time?

Apr 27, 2010

I'd like to have two gnome clock applets, one with the regular default time and date in the upper right hand corner (the default) and another set to epoch time. However, I can't figure out how to set the second gnome clock applet to display the epoch time. I'm running FC12.

View 4 Replies View Related

Programming :: Perl: Turning A Seconds-since-the-epoch Number Into "X Days Ago" Or Similar?

Aug 26, 2010

Is there a perl module that will let me turn numbers into human readable measures of time? For example, 1280513294 would be "26 days ago". If so, what's its name?

View 2 Replies View Related

Fedora :: Partition Only A Fraction Of Size?

Oct 11, 2010

I created a fat32 partition using command line (parted) and though I specified it to be 100 GB, it only has a 10 gig storage capacity. Disk full prompts when I try to exceed 10 gigs.

fdisk -l
...
/dev/sda2 1 12158 97654784 c W95 FAT32 (LBA)
...

View 3 Replies View Related

Ubuntu :: Display Images With Refreshing In Fraction Of Second

Jan 5, 2010

I m mew at linux programing an working on a project that is sort of cctv cmra monitoring i m now facing problem with part of my program for displaying the received image in window and also updating it timely by closing and opening new window or refreshing the same one...........i have no idea where to start study ........system command "display" is not fulfilling the purpose... its not refreshing until window is closed manually, control to the program is not returning back without forcefully closing.

View 2 Replies View Related

Programming :: Function Handler Is Called One Time Only Instead 2 Times If The 2 Timers Expires At A Time

Mar 2, 2011

I am using Debian linux. I have 100 timers running. If a timer expired which will generate a signal and it was mapped to a same function handler. All the timers are mapped to one function handler. The problem is if the timer expires one at a time, the function handler called at a time. But if the 2 timers expires at a time, the function handler is called one time only instead 2 times. Is it possible to invoke the function handler as many times based on timer expirary happens simultaneoulsy?

View 14 Replies View Related

Programming :: Get The Current Time As Provided From NTP (not The Currently Set Time On The Server)?

Jun 9, 2010

Is there a way to get the current time as provided from NTP (not the currently set time on the server)?

View 4 Replies View Related

Programming :: Set Time Using Settimeofday But It Sets Local Time?

Jan 12, 2010

I am trying to set time using settimeofday in linux. But it sets local time. i.e works like SetLocalTime in windows. But I want to set system time(like SetSystemTime in windows). I could'nt find no other api in linux. What should i do? I had tried with mktime/gmtime apis

View 3 Replies View Related

Programming :: Run 'time' On A Function?

May 30, 2010

Code:
#!/bin/ksh
(...)
# FILL UP PARTITION
diskfillerfunction () {

[Code]....

Test 15: fill up partition /usr/bin/time: cannot run diskfillerfunction: No such file or directory

I am obviously omitting (...) a lot of the code, but the relevant part is all there. How do I 'time' a function?

View 5 Replies View Related

Programming :: Cpu Time Taken By An Executable To Run ?

Jun 2, 2010

I want to find the cpu time taken by an executable to run.. the executable is writting the output to a file. i want to write the time takem by cpu to the same output file.

like:

abc is my executable which is taking input as input file and writing the result in output file.. i want to append cpu time information in the same file. can i do it with time command?

View 5 Replies View Related

Programming :: Array Creation At Run-time In C++?

Apr 4, 2010

I have a text file from which i read a number of names with their lengths at the run-time.Now i want to created a char array having the length and name as already read from the text file at the run-time. There is no compilation involved. Every thing is happening at the run-time. I tried using STL like map along with malloc but i am unable to name an array at run-time. I can keep some type of mapping with previously created arrays

View 3 Replies View Related

Programming :: Measure Time Of N Processes?

Oct 24, 2010

how can I measure time of N processes and N threads and then compare this time to prove that threads are faster than processes. understanding C code, or also for some good way to measure time of N processes and N threads for C.

View 5 Replies View Related

Software :: Real Time Programming ?

Mar 20, 2009

I want to start real time programming for linux(RTOS) so where I can get the basic of programming.I want to do it in C language..

View 2 Replies View Related

Programming :: Execute Code For N Time?

Apr 23, 2011

I'm doing a program and I want it to execute some code during n seconds. For example e put a command in the shell like this 'ls % 10' and the program should run the command ls for 10 seconds.I'm trying something like this:

Code:
pid = fork();
if(pid == 0) {

[code]....

View 2 Replies View Related

Programming :: Get The Creation Time Of A Process Via Pid In C++

Mar 22, 2010

Scenario: ( in C++ code)

I need a process A to be able to get the start time of process B. I have the PID of the process B.

I would have thought there would be a simple system call to make by passing in the pid of Process B, but I don't thing there is??!!

So my other thought is to create a script that will be passed the pid and either I can read the file creation of /proc/<PID>/stat or I could also parse the start time of ps on the <PID>. This script can be ran from the C++ code. My difficulty is capturing this information in the C++ code. If I run exec ( or system if not a script) I need the results in a program variable....not stdout.

My only solution is write it to a tmp file and read it back into the program variable. Seems rather arguious but a least it would work.

Background - I need to port Windows code ( GetProcessTimes(creationtime,...))

View 4 Replies View Related

Programming :: Use Multiple Options At The Same Time?

Dec 4, 2010

I want to be able to use multiple options at the same time and some of those options will require an argument and some will not.

Here is my bash script:

#!/bin/bash
while getopts ":a:bc:de:fg:" opt ; do
case $opt in
a)

[Code]....

If I only use option -a with no arguments, the script works...

View 1 Replies View Related

Programming :: Output Time In Ms From Gettimeofday?

Apr 23, 2010

i am trying to print the time in ms using the gettimeofday function, but on execution the shell gives: Segmentation fault (core dumped) error and leaves the program.. here is the code:

struct timeval time1,time2;
double time_used1;
//get time1
gettimeofday(&time1, NULL);

[code]....

View 3 Replies View Related

Programming :: Python Program For Time ?

Jun 24, 2011

I need to write a program for time. like i have 2 tasks both minutes and hours.

like this
1st task=5 hours and 30 minutes
2nd task=2hours and 45 minutes

Together they will take 8 hours and 15 minutes.

I need to write a program thats called ADDTIMES to do something like this.

This is what i have so far.

H1=int(input("enter the number of hours:")) etc..

View 6 Replies View Related

Programming :: Real-time Application ?

Sep 11, 2009

I seed a suggesting related asychron io. I'm write a program which use completion ports, but wandor how avoiding loops like for(; below...i.e I want parse proto with count in first and then computing some quantity of pieces. how that make with aio?

Code:

View 6 Replies View Related

Programming :: Retrieve All Process That Use Over 10% CPU Time?

Apr 23, 2010

Writing a bash shell script that list all process that use over 10% CPU time?

View 1 Replies View Related

Programming :: Appending A Time Stamp To Prstat

Aug 9, 2010

I am trying to run prstat for an extended time, outputting to a file and appending a time-stamp to each line (running on Solaris 10). I have tried this:

prstat -c -U usrname 60 480 | nawk '$1=="PID" { "date +%d%m%Y-%H:%M:%S" | getline d ; close("date") } { print d,$0 }' > /tmp/fileName &

this only appends the time the command was started to each line. I would like to fix this so that a new time is recorded every 60 seconds.

View 1 Replies View Related

Programming :: Bash Find Files On Time Help?

Mar 11, 2011

I am trying to find a nightly backup if it was successfully copied over, rename it and curl, but it's always passing the check even if the file is older than specified. From the command line it does as it should. Example is here;

Code:
find /backup -type f -mmin +4440 -exec echo "found" {} ;
- nothing returned (good). Then I change the time

[code].....

View 4 Replies View Related

Programming :: Checking Os And Process State At Run Time?

May 11, 2010

How can i check what operating system, i am running on, at run time?Moreover, how can i retrieve that current state of process?

View 4 Replies View Related

Programming :: Clock() - Calculate How Much Time Does My Program Run?

May 11, 2011

im trying to calculate how much time does my program run, use very simple script

clock_t end, start;
start= clock();
int i;
printf("initial %d
",(int)start);
[Code]....

but it outputs 0 all the time. cant figure out where could be the problem.

View 2 Replies View Related

Programming :: Detect Current OS In Compile Time?

Dec 8, 2010

Code:

#if defined(WIN32) || defined(WIN64)
#define WINDOWS
#endif

[code]....

what is the directive thats required to detect a linux system? i want to to be able to detect which platform im compiling on automatically.

View 5 Replies View Related

Programming :: Difference In Time Recorded By Clock_gettime() And TSC?

Jan 24, 2011

I want to measure the time it takes to execute a C function. The question is which is the best method to record time. After a lot of searching online, I found two ways [URL]:

a. using clock_gettime(CLOCK_MONOTONIC, &t)
b. using TSC

I call the C function 50 times (recording the time it takes for each call). The average is found only for the last 35 calls.

Using (a), I get:

48345 us
28350 us
28379 us
27716 us

[code]....

Average time for the last 35 loops: 121450.47 microseconds

Using (b), I get:

48130 cycles
28726 cycles
28820 cycles
27421 cycles

[code]....

Average for the last 35 loops: 27236.66 cycles What could be causing the strange value of 3322259 us in method (a)? I could just use method (b) but I would like to know what is going on here... Btw, I am using a desktop - with Linux debian 2.6.26 #1 SMP.

View 7 Replies View Related

Programming :: Read In A File 1 Line At A Time?

Oct 22, 2010

i am trying to read in a file 1 line at a time and for some reason it stops printing out at about line 62,000.

i am doing this:
Code:
while(fgets(c0, 1085, fstream0) != NULL)

but after about 62,0000 lines it stops printing. no seg-fault, no core dump. it just stops printing to the terminal then returns me to the command line after a couple of minutes. as a hack i am doing split -l 50000 on the input and calling my program 5 times.is there some limitation on fgets that i am not understanding ?

View 8 Replies View Related

Programming :: Calculate The Time Taken For A Sample Program To Run?

Apr 24, 2011

i have the example code below, i want to calculate the time taken for a sample program to run. but i keep getting undefined reference error.

#include <sys/time.h>
#include <iostream>
int main(int argc, char **argv) {
struct timeval startTime;
struct timeval endTime;

[Code]...

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved