Re: Getting -ve timestamp values.



jdthebigj@xxxxxxxxx wrote:
I am not a very good unix programmer. I'm trying to get timestamps for
my packets. I tried using the SO_TIMESTAMP flag for obtaining the time
stamp. But it is returning me -ve timestamps. Can you tell me what the
problem is in my code. I checked the system date and time and it is
absolutely correct.
[snip]


time = ctime(&ts);
printf("Received: %s at time: %d = %s",&msg,ts,time);

I have no idea what you mean by "-ve", but assume that you mean "negative". If so, work on your spelling.

Anyway, time_t is not a signed type, it is unsigned. To print it, use %lu and cast the value to (unsigned long).
printf("Received: %s at time: %lu = %s",&msg,(unsigned long)ts,time);


HTH
Bjørn
[snip]

--
Looking for an embeddable web server?
http://www.metasystems.no/products/highlander/index.html
.



Relevant Pages

  • Re: Windows Media Services plugin
    ... resulting split files the video freezes up at the ... With the corrected timestamps, ... file F1, F2, F3, etc starts with a discontinuity flag. ... wmvappend as that flag then appears in the output file ...
    (microsoft.public.windowsmedia.sdk)
  • Re: Q: Perforations of modern US definitives
    ... modern US definitives: ... When sorting some 29 c "Flag with pledge of allegiance" stamps ... that the perforations varied. ... A 2002 First Class flag definitive, apparently a coil stamp ...
    (rec.collecting.stamps.discuss)
  • Re: Time Stamp
    ... For details on how to set up timestamps, do a search and read the previous ... > I have form that I would like to add a time stamp to. ... > sure the date doesn't update everytime you click on the record. ... This form has a subform. ...
    (microsoft.public.access.forms)
  • Re: russian error stamp
    ... I find myself with a russian stamp w/ a ... stamp, which is 37mm tall and 27mm wide. ... flag, w/ the US flag on the left, and the British flag on the right. ... Michel mentions the blue missing error. ...
    (rec.collecting.stamps.discuss)
  • russian error stamp
    ... I find myself with a russian stamp w/ a ... stamp, which is 37mm tall and 27mm wide. ... flag, w/ the US flag on the left, and the British flag on the right. ... The error is a distinct lack of blue ink, including the blue area of the ...
    (rec.collecting.stamps.discuss)