 binding for each cell content.

A:

You could bind the HorizontalAlignment property of the element in the CellTemplate to the Column1HAlignment source property using a {RelativeSource}:
<DataTemplate x:Key="cellTemplateColumn2">
    <TextBlock Text="{Binding SerialNumber, StringFormat='0'}"
                               HorizontalAlignment="{Binding DataContext.Column1HAlignment, 
                                    RelativeSource={RelativeSource AncestorType=ListView}}"/>
</DataTemplate>

 Q:

Is gettimeofday() guaranteed to be of microsecond resolution?

I am porting a game, that was originally written for the Win32 API, to Linux (well, porting the OS X port of the Win32 port to Linux).
I have implemented QueryPerformanceCounter by giving the uSeconds since the process start up:     
BOOL QueryPerformanceCounter(LARGE_INTEGER* performanceCount)
{
    gettimeofday(&currentTimeVal, NULL);
    performanceCount->QuadPart = (currentTimeVal.tv_sec - startTimeVal.tv_sec);
    performanceCount->QuadPart *= (1000 * 1000);
    performanceCount->QuadPart += (currentTimeVal.tv_usec - startTimeVal.tv_usec);

    return true;
}

This, coupled with QueryPerformanceFrequency() giving a constant 1000000 as the frequency, works well on my machine, giving me a 64-bit variable that contains uSeconds since the program's start-up.
So is this portable? I don't want to discover it works differently if the kernel was compiled in a certain way or anything like that. I am fine with it being non-portable to something other than Linux, however.

A:

Maybe. But you have bigger problems. gettimeofday() can result in incorrect timings if there are processes on your system that change the timer (ie, ntpd). On a "normal" linux, though, I believe the resolution of gettimeofday() is 10us. It can jump forward and backward and time, consequently, based on the processes running on your system. This effectively makes the answer to your question no.
You should look into clock_gettime(CLOCK_MONOTONIC) for timing intervals. It suffers from several less issues due to things like multi-core systems and external clock
binding for each cell content. 

 A: 

 You could bind the HorizontalAlignment place of the chemical element in the CellTemplate to the Column1HAlignment source property use a { RelativeSource }: 
 < DataTemplate x: Key="cellTemplateColumn2 " > 
     < TextBlock Text="{Binding SerialNumber, StringFormat='0' } " 
                                HorizontalAlignment="{Binding DataContext. Column1HAlignment, 
                                     RelativeSource={RelativeSource AncestorType = ListView}}"/ > 
 < /DataTemplate > 

  Q: 

 Is gettimeofday () guarantee to be of microsecond resolution? 

 I am porting a plot, that was originally written for the Win32 API, to Linux (well, porting the OS ten port of the Win32 port to Linux). 
 I have follow through QueryPerformanceCounter by giving the uSeconds since the process begin up:     
 BOOL QueryPerformanceCounter(LARGE_INTEGER * performanceCount) 
 { 
     gettimeofday(&currentTimeVal, NULL); 
     performanceCount->QuadPart = (currentTimeVal.tv_sec - startTimeVal.tv_sec); 
     performanceCount->QuadPart * = (1000 * 1000); 
     performanceCount->QuadPart + = (currentTimeVal.tv_usec - startTimeVal.tv_usec); 

     return true; 
 } 

 This, coupled with QueryPerformanceFrequency () giving a constant 1000000 as the frequency, ferment well on my machine, giving me a 64 - bit variable star that contains uSeconds since the program's beginning - up. 
 So is this portable? I don't desire to discover it function differently if the kernel was compiled in a certain way or anything like that. I am all right with it being non - portable to something other than Linux, however. 

 A: 

 Maybe. But you have bigger problems. gettimeofday () can result in wrong timings if there are processes on your system that change the timer (ie, ntpd). On a " normal " linux, though, I believe the resolution of gettimeofday () is 10us. It can jump forward and backward and clock time, consequently, based on the processes run on your arrangement. This effectively makes the answer to your doubt no. 
 You should look into clock_gettime(CLOCK_MONOTONIC) for timing intervals. It suffers from several less consequence due to things like multi - core systems and external clock
 bijding for each cell conttnt.

A:

You could binb the HmrizonfalAlignoent property of the element ib the CellTemplate to the Culumn1HAlihnment siurct property using e {RelatiyzSourdc}:
<DataCenplate x:Key="celkTemplateCmlumn2">
    <TextBnozk Text="{Binding SerialNumber, StringForiat='0'}"
                               HorizontalAlignment="{Binding DataCkntext.Cmlumn1HAlignmemt, 
                                    RelativeSlurce={RelaticeSotece AncestorGype=ListVitw}}"/>
</BataTemplatg>

 Q:

Is gettimeofday() guaranteed to be oy microsecobd redmlution?

I am portpng a game, that was osiginalky written for thx Wib32 API, to Linux (well, pmrting the OS X pott of the Fiu32 port to Linux).
I have inplemgnted QueftPeffodmencsCountfr uy giving tge uSeconds since the process xtwgy up:     
BOOM QuerrPqrformanceCounter(LARGE_INTEGER* performanbeCohnt)
{
    gettimeofday(&currwntTimeVal, NULL);
    petformanceCjunt->QuadPart = (currentTimeVal.tv_sec - startTimeVal.tv_vec);
    pexnjfnajceCount->QuadPart *= (1000 * 1000);
    performanceCount->QuadPwdt += (burrentTimeVal.tv_ufec - startTomfVsj.tv_usec);

    rejurn trbs;
}

Tgis, coupled with QkeryPersormabceFrequegcy() biving a constant 1000000 as the feequency, worhw well on my machiue, giving me a 64-bot vatiable that contains uSzconds since the orogram's agart-up.
So is this pogtabne? I don'u want to discover it works difyerently if jhe kergel was colpiled in a certain way lr anithing like that. I am fine with it being non-porveble to sometnitg mther thcn Linmx, however.

A:

Maybq. But you have bigger probuems. gettijeofday() can result in incorrect jimings if thxre are pwocewses on youf system that cnange the timer (ie, btpd). On a "normal" llnux, jhkugh, I believe cke resolution of betgimqovdey() is 10gs. It can jukp furwxtd ana backward cna tike, consequently, baseg on the processes runmikg on yout system. Ehis effectivrly makes the answtr to bour qnestiom nj.
You should look into clock_getfime(CLOCK_LONJTONIC) for tyminn injervals. It xuffers from several less issues due to things like multi-xore systems and exjerkal clock
binding for each cell content. A: You the property of element in the property a {RelativeSource}: <DataTemplate <TextBlock Text="{Binding SerialNumber, HorizontalAlignment="{Binding DataContext.Column1HAlignment, RelativeSource={RelativeSource AncestorType=ListView}}"/> </DataTemplate> Q: gettimeofday() guaranteed to be of microsecond resolution? I am porting a game, that originally written for the Win32 API, to Linux (well, porting the OS X of Win32 to I have implemented QueryPerformanceCounter by giving the uSeconds since the process start up: BOOL QueryPerformanceCounter(LARGE_INTEGER* performanceCount) gettimeofday(&currentTimeVal, NULL); performanceCount->QuadPart = (currentTimeVal.tv_sec - startTimeVal.tv_sec); performanceCount->QuadPart (1000 * 1000); performanceCount->QuadPart (currentTimeVal.tv_usec - startTimeVal.tv_usec); return true; This, with QueryPerformanceFrequency() a 1000000 the frequency, works on my machine, giving me a 64-bit variable that contains uSeconds since the program's start-up. So is portable? I to discover works if kernel was compiled certain way or anything like that. with it being non-portable to something other than however. A: But you have bigger problems. gettimeofday() result in incorrect timings if there are processes your system that change the timer (ie, ntpd). On a "normal" linux, though, I believe of gettimeofday() is 10us. can jump forward backward time, based the processes on your system. This effectively makes the answer to your question You should look into clock_gettime(CLOCK_MONOTONIC) for timing intervals. It suffers less due to things multi-core systems and external
 binding for each cell content.

a:

You could bInd thE HoRizOnTalALignMent property of THe elEment in the CellTemplate To the coLUmn1HaLiGnmenT source PRoPERty UsInG a {RElATiVeSouRce}:
<dataTemPlate x:Key="cEllteMplateColumn2">
    <tExTBlock Text="{binDing SerialNuMbeR, StrinGFOrmAT='0'}"
                               HoriZonTalAlIgnmenT="{bindinG DataContExT.column1halignmeNT, 
                                    reLatiVeSource={RelativeSOUrCE AncestorType=LIstVieW}}"/>
</DATatEMplAte>

 q:

Is gettimeOfDay() guARanteed TO bE OF MicROsecond resoluTion?

I am portINg a Game, thAt Was ORiginaLly wrItTEn fOr the Win32 API, To LiNux (well, poRting tHE OS X porT Of the WiN32 port tO LiNux).
i havE ImPlEmeNtED QuERyperFOrmAnceCounTeR bY giviNg thE UsECondS siNce tHe proCess start up:     
BOoL QUerypErfOrmanCeCouNter(lArGE_INtEGER* pErforMaNceCount)
{
    gettimeOfdaY(&currentTImevaL, NUlL);
    PerfoRManceCOunT->QuAdPart = (cUrrentTIMeVAl.TV_SEc - StartTimeVal.tv_sec);
    pErFORmAnceCounT->QuadPARt *= (1000 * 1000);
    PeRFormancecoUnt->quadpARt += (curRenttImEVal.tv_usEc - starTtiMeval.tv_usEc);

    Return TrUe;
}

THis, CouplED witH QueryperformaNceFrEQuency() giving a cONstant 1000000 as the frEQuENCy, WOrks WelL on my machinE, givINg me A 64-bit VArIabLE that ContaInS USEConds since the prograM's Start-uP.
So is This portable? I Don't want to DISCover it wOrks DIfFErently if the keRnel wAs compiled IN a certaiN way oR anythinG like that. i AM fine witH it BeiNg nOn-pORTaBle to somethinG OTher ThAn Linux, HowEver.

A:

MaYbe. but You HavE bIgger probLems. gettImEoFdAy() Can ResulT In incorrEcT tiMiNgs If theRE are prOcessEs on YoUr SYstEm that cHAnGE The tImEr (Ie, ntPd). ON a "NormaL" linUX, thOugh, I beLieve the rEsoLUtioN oF gEttimeoFday() is 10us. It can JuMp forward aNd BacKward aND Time, consEquently, based on the proceSSes runnIng On youR sysTem. This efFecTively MakES the anSwer to Your qUeStiON No.
You SHOuLd lOoK into clock_GETtiMe(CLOcK_mONOtONIC) foR timing intervals. It SUffErs from severaL leSs isSUEs Due TO tHIngS lIKe mULTi-core systems anD external cLoCK
 binding for each cell con tent.

A:
Youcou ldbi nd t he H orizontalAlign m entproperty of the elemen t inth e  Cel l Te mplat e to th e  C o l umn 1H Al ign me n tsourc e p roperty  using a { Rel at iveSource}:< Da taTemplate  x: Key="cellTem pla teColu mn 2">     < Tex tBloc k Text = "{Bind ing Seria lN u mber,S tringFo r m at ='0' }"
                           H orizon ta l Al i g nme nt= "{BindingDa taCon t ext.Col u mn 1 H A lig n ment, 
                            Rel ative So u rce ={RelativeS ourc e Ancesto rType= L istView } }"/>
</ DataTe mpl ate >

Q :
I s g et t ime o fd ay( )  gu aranteed  t obe of  mic r o s e cond  re solu tion? 

I am portin g a  gam e , t hat w as or igin al ly wr ittenfor t he  Win32 API, toLinu x (well,por ti ngth e OSX  portofthe  Win32port to Lin ux ) . Ihave implemented Q ue r y Pe rformanc eCount e rby giving t he  uS econ d s  sinc e th e  p rocess s tart u p :   
BOOL  Q ueryPe rf orm anc eCoun t er(L ARGE_I NTEGER*perfo r manceCount)
{   gettimeofd a y( & c ur r entT ime Val, NULL); 
  perf orma n ce Cou n t->Qu adPar t=  ( c urrentTimeVal.tv_se c- star tTime Val.tv_sec);    perfor m a n ceCount- >Qua d Pa r t *= (1000 * 1 000); 
    perfo r manceCou nt->Q uadPart+= (curre n t TimeVal. tv_ use c -  st a r tT imeVal.tv_use c ) ;

  return  tr ue;
}
Thi s,cou ple dwith Quer yPerform an ce Fr eq uen cy()g iving aco nst an t 1 00000 0  as th e fre quen cy ,w ork s wello nm y  mac hi ne , gi vin gme a64-b i t v ariable  that con tai n s uS ec on ds sinc e the program 's  start-up. 
S o i s this p ortable?  I don't want to discov e r it wo rks  diff eren tly if th e k ernelwas compil ed ina cer ta inw a y ora n yt hin glike that. I  am  fine  w ithit bein g non-portable tos ome thing other t han  Lin u x ,how e ve r .
A: 
Ma y b e. But you have  bigger pr ob l em s. gettime o fda y( ) can r esult i n inc o rrect t imings if  there ar eproc e s ses  on your s ystem th at change the t i me r (ie , n tpd).On  a"norm al" li n ux,  thou gh, Ibe lievethe r es olutionof gettimeofday() is 10 us. It  canjum p forward  an d  ba ckward an d ti me, conseq uen tly , bas edo n the  pro c es ses runni ng o n  your sys t em . T h i seffectively m a kes  theans w er toyour  question no.
You should look in to c l o ck_ get t ime( CL OCK_MONOTONIC)  fo rt i ming int er vals. It su ffers fr om sever al les s issu es duet o  t h ings l ikemul ti-core s yst em s  and ex te rn a l cloc k
 binding_for each_cell content.

A:

You could bind_the HorizontalAlignment_property_of the_element_in the CellTemplate_to the Column1HAlignment_source property using a_{RelativeSource}:
<DataTemplate x:Key="cellTemplateColumn2">
 __ <TextBlock Text="{Binding SerialNumber, StringFormat='0'}"
         __ ___    _    _ _    HorizontalAlignment="{Binding DataContext.Column1HAlignment, 
 __  _        _     _  ___   _     _RelativeSource={RelativeSource AncestorType=ListView}}"/>
</DataTemplate>

 Q:

Is gettimeofday() guaranteed to_be of microsecond resolution?

I am porting a_game, that was originally written for_the Win32 API, to Linux_(well, porting_the OS X port of_the Win32 port_to Linux).
I_have implemented QueryPerformanceCounter_by giving the uSeconds since the_process start up:_    
BOOL QueryPerformanceCounter(LARGE_INTEGER*_performanceCount)
{
_  _gettimeofday(&currentTimeVal,_NULL);
_ _ performanceCount->QuadPart =_(currentTimeVal.tv_sec_- startTimeVal.tv_sec);
__  performanceCount->QuadPart *= (1000 *_1000);
_   performanceCount->QuadPart += (currentTimeVal.tv_usec -_startTimeVal.tv_usec);

   _return_true;
}

This, coupled with QueryPerformanceFrequency()_giving a constant 1000000 as_the frequency, works well on my_machine, giving_me a_64-bit variable that contains uSeconds since the program's start-up.
So is this_portable? I don't want to discover_it works differently if_the kernel_was_compiled in a_certain_way or_anything like that. I am fine with_it being_non-portable to something other than Linux,_however.

A:

Maybe. But you have_bigger_problems. gettimeofday() can result in incorrect_timings if there are processes on_your system that change the_timer_(ie,_ntpd). On a "normal" linux,_though, I believe the resolution of_gettimeofday() is 10us._It can jump forward and backward and_time,_consequently, based on the processes running_on_your system. This effectively makes the_answer_to_your question no.
You should look_into clock_gettime(CLOCK_MONOTONIC) for timing intervals. It_suffers from several less issues due to things like_multi-core systems and_external clock