Re: [Nut-upsdev] NUT Bugs #313634 & #313714: unification & encapsulation of timer proposition

2012-10-09 Thread VaclavKrpec
Hi Arnaud, The below link will provide you a good summary of the situation, what we can do and how. AFAICT, there is no way on HPUX (and some other older Unix) to use clock_gettime with CLOCK_MONOTONIC, but CLOCK_REALTIME (which is functionally different). gethrtime (high resolution time) seem

Re: [Nut-upsdev] NUT Bugs #313634 & #313714: unification & encapsulation of timer proposition

2012-10-09 Thread Arnaud Quette
Vasek, first, please refer to my previous answer, a few hours ago (including links). I've not bothered summing up myself, since the link does pretty well. you'll find there most if not all answers to your questions. 2012/10/9 > Hi Charles, > > > I don't think we should ignore an EINVAL error, a

Re: [Nut-upsdev] NUT Bugs #313634 & #313714: unification & encapsulation of timer proposition

2012-10-09 Thread VaclavKrpec
Hi Charles, > I don't think we should ignore an EINVAL error, and we should fall back to > gettimeofday() in that case. (I know gettimeofday is deprecated, but if > CLOCK_MONOTONIC isn't quite right, then gettimeofday should work.) Aw, I think I might have been too fast with condemning gettimeo

Re: [Nut-upsdev] NUT Bugs #313634 & #313714: unification & encapsulation of timer proposition

2012-10-09 Thread VaclavKrpec
> > Clarification: I do clock_gettime(CLOCK_MONOTONIC, &tm) and if that > > fails with EINVAL and the user requested MONOTONIC_PREF (i.e. > > fall-back to RTC is allowed), I do another > > clock_gettime(CLOCK_REALTIME, &tm) which should always work. > > > > However, I wonder whether this isn't too

Re: [Nut-upsdev] NUT Bugs #313634 & #313714: unification & encapsulation of timer proposition

2012-10-09 Thread Charles Lepple
On Mon, Oct 8, 2012 at 8:57 AM, wrote: > Hello Charles, > > you can take a look at the code in branches/Vaclav/common/clock.c vi viewvc. Oh, I thought you were referring to a later revision than what was checked into SVN. > Clarification: I do clock_gettime(CLOCK_MONOTONIC, &tm) and if that > f

Re: [Nut-upsdev] NUT Bugs #313634 & #313714: unification & encapsulation of timer proposition

2012-10-09 Thread Arnaud Quette
Hi Vasek 2012/10/8 > Hello Charles, > > you can take a look at the code in branches/Vaclav/common/clock.c vi > viewvc. > > Clarification: I do clock_gettime(CLOCK_MONOTONIC, &tm) and if that > fails with EINVAL and the user requested MONOTONIC_PREF (i.e. fall-back > to RTC is allowed), I do anot