C header file : time.h in c language in hindi , Timedifference , time function , Clock ,asctime और asctime_s

Timedifference , time function , Clock ,asctime और asctime_s , C header file : time.h in c language in hindi :-
हमने अभी तक C language मे math.h ,string.h ,stdio.h और  conio.h header file को पढ़ा है लेकिन इसके अलावा time.h header file जिसमे date और time related function define होते है जिसे डायरेक्ट प्रोग्राम मे use किया जाता है |इसका syntax होता है :-
#include<time.h>
time.h header file मे निन्म function include होते है :-
1. Timedifference
जब किसी दो calender के दो date के बीच time difference को calculate करना होता है इस function का use किया जाता है |इसमें आउटपुट second मे आता है |इसका syntax होता है :-
difftime(start time ,end time );
यहा पर
difftime : ये keyword है जिससे time difference function को call किया जाता है |
start time : ये starting time को define करता है जिससे कैलकुलेशन start करनी है |
end time : ये ending time को define करता है जिससे कैलकुलेशन end होती है |
अगर end time start time से पहले होती है तब इस function का आउटपुट negative आती है |इसका उदाहरण है :-
#include<stdio.h>
#include<conio.h>
#include<time.h>
void main()
{
time_t n;
time(&n);
struct first;
first = *localtime(&n);
first.month = 0;
first. minute=0;
first.second=0;
first.day=1;
double diff=difftime(n,mktime(&first));
printf(“%f second pased form beginning of month. “, diff);
getch();
}
इस उदहारण मे ,variable ‘n’ मे current time को assign किया गया है और first मे month के begining का time को set किया गया है |difftime() function से time difference को calculate किया गया है और print किया गया है |
आउटपुट होगा :
123454656 second passed form beginning of month.
 
2. time function
जब किसी  calendar के current date को  calculate करना होता है तब इस function का use किया जाता है |इसमें आउटपुट standard time format मे आता है |इसका syntax होता है :-
time(time pointer variable);
यहा पर
time : ये keyword है जिससे current time function को call किया जाता है |
time pointer variable : ये pointer variable होता है जिसमे current time store होता है|
अगर ये function execute होता तब current time को time pointer variable की form मे एनकोड कर देता है और इसे time pointer variable के address पर store कर देता है |
3. Clock
इस function का use प्रोसेसर द्वारा किसी प्रोसेस मे लगा समय को calculate करने के लिए किया जाता है|ये time किसी प्रोग्राम के execution मे लगा time को define करने के साथ ही start होता है | जब time को कैलकुलेट कर लिया जाता है तब इसे clock per sec से डिवाइड करके फाइनल आउटपुट मिलता है |
इस function मे time difference function को use किया जाता है |जब किसी function का start और terminate होने के बीच के time difference को calculate किया जाता है इसका  syntax होता है :-
clock (pointer variable );
यहा पर
time : ये keyword है जिससे current time function को call किया जाता है |
time pointer variable : ये pointer variable होता है जिसमे process मे लगा time  store होता है|
अगर ये function execute होता तब  process मे लगा time  को time pointer variable की form मे एनकोड कर देता है और इसे time pointer variable के address पर store कर देता है |
Format Conversion
1. asctime और asctime_s
इन function का use, current date  को 25 textual character मे convert करने के लिए किया जाता है |ये 25 charecter का form होता है :-
www mmm dd hh:mm:ss yyyy
यहा पर :
www: ये week day को contain करता है |इसके लिए तीन character के abbreviation को use किया जाता है |जैसे monday के लिए mon ,और friday के लिए fri |
mmm:ये month name  को contain करता है |इसके लिए तीन character के abbreviation को use किया जाता है |जैसे march के लिए mar ,और December के लिए dec |
dd : ये date मे से day को contain करता है |
hh : ये  hour की value  को contain करता है |
mm: ये minutes की value को contain करता है |
ss: ये second की value को contain करता है|
yyyy : ये year की value को contain करता है |
2. ctime और ctime_s
इन function का use, current time को 25 textual character मे convert करने के लिए किया जाता है |ये 25 charecter का form होता है :-
www mmm dd hh:mm:ss yyyy
यहा पर :
www: ये week day को contain करता है |इसके लिए तीन character के abbreviation को use किया जाता है |जैसे monday के लिए mon ,और friday के लिए fri |
mmm:ये month name  को contain करता है |इसके लिए तीन character के abbreviation को use किया जाता है |जैसे march के लिए mar ,और December के लिए dec |
dd : ये date मे से day को contain करता है |
hh : ये  hour की value  को contain करता है |
mm: ये minutes की value को contain करता है |
ss: ये second की value को contain करता है|
yyyy : ये year की value को contain करता है |
इस function मे तीन parameter pass होते है :-
1.time :- ये pointer होता जिसे convert करना होता है |
2.buffer : ये buffer के size को specify करने के लिए pointer होता है |
3.bufsz : ये buffer की size को bytes मे define करता है |
इस function से  time का string conversion return होता है जो की asctime() और ctime () के बीच use किया जा सकता है |अगर कन्वर्शन success हो जाता है तो ‘0’ भी return होगा अन्यथा non zero value return होगी |
इसके अलावा निन्म function को conversion  के लिए use किया जा सकता है :-
1.gmtime ,gmtime_s : in function का use ,time को UTC specify charecter set convert किया जाता है |
2.localtime ,localtime_s : इन function का use ,time को local time struture form मे convert करने के लिए किया जाता है |
3.mktime : इस function का use, day के बिना time को show करने के लिए किया जाता है |
इस प्रकार time.h header file मे उपस्थित function और conversion को use करके time और date releated operation किया जा सकता है |