JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now

हिंदी माध्यम नोट्स

Class 6

Hindi social science science maths English

Class 7

Hindi social science science maths English

Class 8

Hindi social science science maths English

Class 9

Hindi social science science Maths English

Class 10

Hindi Social science science Maths English

Class 11

Hindi sociology physics physical education maths english economics geography History

chemistry business studies biology accountancy political science

Class 12

Hindi physics physical education maths english economics

chemistry business studies biology accountancy Political science History sociology

Home science Geography

English medium Notes

Class 6

Hindi social science science maths English

Class 7

Hindi social science science maths English

Class 8

Hindi social science science maths English

Class 9

Hindi social science science Maths English

Class 10

Hindi Social science science Maths English

Class 11

Hindi physics physical education maths entrepreneurship english economics

chemistry business studies biology accountancy

Class 12

Hindi physics physical education maths entrepreneurship english economics

chemistry business studies biology accountancy

Categories: C Language in hindi

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 किया जा सकता है |
Sbistudy

Recent Posts

four potential in hindi 4-potential electrodynamics चतुर्विम विभव किसे कहते हैं

चतुर्विम विभव (Four-Potential) हम जानते हैं कि एक निर्देश तंत्र में विद्युत क्षेत्र इसके सापेक्ष…

1 day ago

Relativistic Electrodynamics in hindi आपेक्षिकीय विद्युतगतिकी नोट्स क्या है परिभाषा

आपेक्षिकीय विद्युतगतिकी नोट्स क्या है परिभाषा Relativistic Electrodynamics in hindi ? अध्याय : आपेक्षिकीय विद्युतगतिकी…

3 days ago

pair production in hindi formula definition युग्म उत्पादन किसे कहते हैं परिभाषा सूत्र क्या है लिखिए

युग्म उत्पादन किसे कहते हैं परिभाषा सूत्र क्या है लिखिए pair production in hindi formula…

5 days ago

THRESHOLD REACTION ENERGY in hindi देहली अभिक्रिया ऊर्जा किसे कहते हैं सूत्र क्या है परिभाषा

देहली अभिक्रिया ऊर्जा किसे कहते हैं सूत्र क्या है परिभाषा THRESHOLD REACTION ENERGY in hindi…

5 days ago

elastic collision of two particles in hindi definition formula दो कणों की अप्रत्यास्थ टक्कर क्या है

दो कणों की अप्रत्यास्थ टक्कर क्या है elastic collision of two particles in hindi definition…

5 days ago

FOURIER SERIES OF SAWTOOTH WAVE in hindi आरादंती तरंग की फूरिये श्रेणी क्या है चित्र सहित

आरादंती तरंग की फूरिये श्रेणी क्या है चित्र सहित FOURIER SERIES OF SAWTOOTH WAVE in…

1 week ago
All Rights ReservedView Non-AMP Version
X

Headline

You can control the ways in which we improve and personalize your experience. Please choose whether you wish to allow the following:

Privacy Settings
JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now