593:
those massive, wide tabs seem un-aesthetic to me (that's a personal thing but the industry seems to like 3 or 4 space indentation) and d) even under flame war discussions, the original indentation was perfectly serviceable. He also claimed that (void) has to be used when the return value of printf() is ignored. It certainly can be used that way but is by no means required. To my mind, this cast gets in the way of this example. A clean, minimal source is preferred so that the topic under discussion is highlighted, without distractions. Lastly, he also added a sample compilation and invocation. This only applies to UNIX and doesn't take into account compilation and invocation under
Windows, Macs, cross compilers for embedded systems, etc. This isn't an article on compiling and invoking C programs. For users not used to Unix, they now have to figure what parts of that are the commands, what parts are the prompts and what part is the actual output. Much better to simply show the output and leave it at that. Thoughts?
307:
670:
Solaris, IRIX, Linux, and FreeBSD kernels.) I am myself part of this industry, being a C programmer for
Cadence Design Systems, Inc. You are, on the contrary, either an amateur or most likely not a C programmer at all, which is easily deduced from your comment on industrial usage of tabs — apparently you never even read any source code of operating systems, drivers, or system software, otherwise you wouldn′t make that erroneous statement. This is why my professional opinion holds a much higher value.
1025:
191:
243:
222:
702:, indicating its optional nature. Such void casts are deemed to be a good practice, because just by glancing at code you can easily tell which calls′ return values are ignored. It is a heavily used (by industry, yeah) convenience technique of the same order as prefixing struct/union member names with struct/union′s shortened name, for example:
842:
No, it's indeed about consistency in
Knowledge (XXG). The industry standard isn't that relevant, since here most of the code examples here span at most 20 lines and what matters is readability in such very specific circumstances. We are not dealing with 100000+ LOC projects or 1000+ LOC files either,
803:
However, I have found that various editors do strange things to tabs. The problem comes when team members uses different editors (many programmers have very strong preferences for their favourite editor) or different settings. Assume the first programmer uses an editor that displays tabs as 4 spaces.
592:
Recently an anonymous editor changed the whitespace from simple spaces to tabs, claiming "UNIX-style indentation" had to be with tabs, not spaces. I reverted this because a) whitespace in C can be spaces, horizontal tabs, vertical tabs and newlines, b) UNIX-style does not restrict it to tabs only, c)
669:
Tab is far more common as an indentation character and is used extensively throughout the industry — this is why your industry comment is false — industry uses tabs with tab width set to either 4 or 8 (never odd, like 3), you can easily see that for yourself by examining source code (quick examples:
793:
I didn't want to get into a flame war over indentation - it's a no win scenario. Be aware that there is no such thing as UNIX style for indentation. Perhaps you meant BSD KNF style? Different places have different forms. Some shops favour one way and some shops favour others. I've seen practically
379:
Yeah Guys.. Just something to think about.. An encyclopedic
Article on time.h would be - well just useless. And i'm happy with the english wikipedia as it is, with thousands of articles to even minor details, headerfiles, comic characters and so on. Please just don't take the german wiki as model,
774:
Curious. I thought a computing degree and 24 years as a paid programmer using mostly C was enough to qualify as a C professional. Perhaps all those years of embedded programming of real time clock chips, serial chips, LCD driver chips, interrupt handlers, etc on embedded systems for trivial
612:
I agree with all your points. I would add that indentation isn't only a personal thing - Knowledge (XXG) prefers consistent style. If we look around, we will see that most of the examples use the original indentation style. So I'd support reverting the changes to the indentation too.
750:
Resume: you twisted every single bit of my edit′s explanation message, reading “required” instead of “optional” and not undestanding the stylistic nature of tab usage. You aren′t even a professional C programmer. Why do you edit C-related articles when you aren′t knowledgeable
808:
fine for the second programmer. Then it goes back to the first programmer but he sees a mix of 3 space indentation and tabs displayed as 4 spaces - horrible! Sad to say but I have seen many so called professional companies do this. Knowledge (XXG) promises to be even
1037:
658:
indentation”, alluding to mere stylistic nature of the matter. It isn′t important whether to use spaces or tabs in such code snippets, the indentation part of my edit was purely aesthetical, made in accordance to my personal (and quite popular)
680:
handy for automated code editing by scripts (regular expressions become ten times simpler, compared to equivalents written for space-indented code) — the technique used extensively throughout the industry for large spanning source trunks and
400:
Also, it's not strictly correct. On at least some systems (most?) there is time.h and sys/time.h, which are not identical. It would be nice if
Knowledge (XXG) were truely autoritative, but one more partly-correct source is not helpful, IMO.
449:
See on page 350 at 7.23.1.(4) Components of time: "The range and precision of times representable in clock_t and time_t are implementation-defined.". Thus, it should be "time_t - time since epoch type for most compilers such as gcc"! (see
153:
866:
and propose the change. But I probably should warn you to be prepared for a long flamewar, since this is what most of similar discussions become. Until there's consensus for a new indentation style, it should stay as is.
692:
a virtue to be chased. Moreover, I noted UNIX because it is the origin of the C programming language, its source code therefore can and should be taken as a reliable source of good C programming practices, including the
965:
The information is also incomplete. It only discusses those functions that deal with second precision. I came here hoping to find useful information for micro- or nanosecond double values, not merely int equivalents.
649:
That anonymous editor was me. First, I′m a C expert and as such am aware that C is a free-form language, allowing both spaces and tabs as whitespace (along with a few other characters); I never claimed tabs to be the
744:
But okay, your point here is reasonable, so let′s keep the cast out and leave it to industry. I agree with your compilation and invocation point too — I tend to forget that non-UNIX operating systems exist, my
998:
C library. The standard C library only goes down to seconds. Anything more precise is handled by extensions or alternatives to the standard C library and is therefore not meant to be covered in this article.
488:
in all contexts as per specification. The undefined thing is the format of the type, not what it represents. Thus since the previous definition doesn't specify anything about the format, it's still correct.
297:
1094:
794:
every possible way, each used across all the common systems (Linux, BSD, UNIX, Solaris, Windows, VMS and many others). Mostly it is a matter of taste, with no clear advantage to any of them.
804:
Then the next programmer uses an editor that displays tabs as 3 spaces and also translates new tab key presses into 3 spaces (jEdit, vi, emacs and many others can do this). So far it all
775:
applications like EFTPOS, airport security scanners and high speed network backbone systems isn't enough. Obviously I need to work at it a bit longer to get away from my amateur status :)
147:
380:
its so full of relevancy that it became entirely irrelevant. Rules like the NO-HOWTO are nice, but only IF the article would be better in an encyclopedic form - not in this case.
1099:
44:
688:
By using tabs for indentation of example code snippets on
Knowledge (XXG) we promote a reasonable, practical, and just handy coding technique, which, in common sense,
909:
No. Applications frequently assume that days are exactly 86400 seconds long. Leap seconds are implemented by "stretching" one time_t second over two real seconds. --
989:
New topics go at the bottom of the talk page. Each topic should have its own title. Each comment should be signed by placing 4 tilde characters at the end (ie ~~~~).
666:
Tab is more flexible, because most text editors allow you to set the tab width, allowing for quick indentation adjustments without any changes to the actual code.
843:
so the cited advantages of tabs largely doesn't apply. In addition to that, most of the readers are not C professionals and they don't necessarily expect to see
79:
1029:
1079:
287:
85:
859:
1089:
1074:
461:
263:
757:
632:
30:
1033:
673:
Tab is more practical, because it takes less bytes to represent a string of tabs compared to a string of spaces of the same visible width.
981:
408:
168:
135:
858:
So if you want to change the indentation style used here, the usual procedure involving such comparatively major changes is to go to
99:
894:
381:
104:
20:
250:
227:
631:
As for indentation, it isn′t about consistency on
Knowledge (XXG), but is about conforming to the common style of the industry.
74:
202:
65:
129:
306:
863:
125:
542:
847:
here. Lastly, C standard library is available in C++ and
Knowledge (XXG) doesn't apparently have articles such as
109:
546:
175:
24:
1024:
761:
636:
465:
315:
262:
topics on
Knowledge (XXG). If you would like to participate, please visit the project page, where you can join
255:
208:
190:
412:
977:
428:
969:
890:
550:
457:
451:
404:
385:
55:
898:
445:
Regarding the "time_t - time since epoch type". This is not true actually as shown in the specification
973:
141:
70:
1028:
This article was the subject of an educational assignment at
College Of Engineering Pune supported by
342:
1007:
826:
601:
1084:
161:
1055:
51:
872:
618:
577:
572:
input, I've moved the page. If anyone disagrees, please express your concerns here. Thanks.
558:
494:
446:
355:
1001:
914:
820:
595:
363:
1059:
1012:
954:
917:
902:
876:
831:
765:
640:
622:
606:
581:
562:
528:
498:
469:
435:
427:
There is a move discussion in progress which affects this page. Please participate at
416:
389:
366:
345:
1068:
1051:
950:
524:
868:
614:
573:
554:
490:
432:
910:
359:
942:
not reflect leap seconds, which is one reason most implementations don't.)
946:
520:
452:
http://ftp.gnu.org/old-gnu/Manuals/glibc-2.2.3/html_chapter/libc_21.html
242:
221:
259:
935:
512:
851:. Thus, the consistency of C and C++ examples is also beneficial.
698:
Second, I never claimed the void cast to be required — I wrote
476:
I don't understand what was wrong with the previous statement.
184:
15:
305:
447:
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf
1036:
during the 2011 Q3 term. Further details are available
516:
784:
Apologies if I misinterpreted 'requires' for 'should'.
160:
931:
reflect leap seconds, although in principle it could.
254:, a collaborative effort to improve the coverage of
174:
1095:India Education Program student projects, 2011 Q3
887:Does the value of time_t include leap seconds?
431:and not in this talk page section. Thank you. —
33:for general discussion of the article's subject.
8:
188:
994:This page covers all the functions of the
967:
216:
1019:India Education Program course assignment
511:be implemented as time since an epoch. (
341:Why not? What else would you put here? --
1100:India Education Program student projects
429:Talk:C standard library - Requested move
337:Knowledge (XXG) is not C documentation.
1044:The above message was substituted from
314:This article falls within the scope of
218:
654:delimiter — that′s why I wrote “UNIX-
541:I propose to rename the article from
517:updated several function descriptions
7:
860:Wikipedia_talk:WikiProject Computing
248:This article is within the scope of
207:It is of interest to the following
23:for discussing improvements to the
507:There is no requirement in C that
14:
515:requires this, but not C.) I've
272:Knowledge (XXG):WikiProject C/C++
50:New to Knowledge (XXG)? Welcome!
1023:
849:C date and time functions in C++
241:
220:
189:
45:Click here to start a new topic.
292:This article has been rated as
1080:High-importance C/C++ articles
1:
955:16:20, 17 November 2015 (UTC)
582:16:20, 25 November 2011 (UTC)
563:16:29, 23 November 2011 (UTC)
529:16:14, 17 November 2015 (UTC)
499:16:28, 23 November 2011 (UTC)
470:13:55, 23 November 2011 (UTC)
390:20:43, 16 February 2010 (UTC)
266:and see a list of open tasks.
42:Put new text under old text.
1060:20:07, 1 February 2023 (UTC)
568:Since I've received exactly
436:09:40, 8 November 2011 (UTC)
1030:Knowledge (XXG) Ambassadors
864:Talk:C programming language
423:Move discussion in progress
417:22:31, 21 August 2012 (UTC)
367:14:18, 8 October 2007 (UTC)
346:07:58, 8 October 2007 (UTC)
333:This is not C documentation
1116:
1090:WikiProject C/C++ articles
1075:Start-Class C/C++ articles
1013:20:43, 22 April 2020 (UTC)
877:16:42, 18 March 2012 (UTC)
832:13:09, 12 March 2012 (UTC)
818:Anyway, no hard feelings!
766:09:38, 12 March 2012 (UTC)
641:09:38, 12 March 2012 (UTC)
623:23:49, 11 March 2012 (UTC)
607:00:18, 11 March 2012 (UTC)
588:whitespace and compilation
543:C date and time operations
275:Template:WikiProject C/C++
547:C date and time functions
313:
291:
236:
215:
80:Be welcoming to newcomers
25:C date and time functions
918:08:02, 4 June 2013 (UTC)
903:06:27, 4 June 2013 (UTC)
705:
1034:India Education Program
310:
197:This article is rated
75:avoid personal attacks
309:
201:on Knowledge (XXG)'s
100:Neutral point of view
105:No original research
354:He is correct, see
1047:{{IEP assignment}}
1038:on the course page
482:"time since epoch"
311:
203:content assessment
86:dispute resolution
47:
985:
972:comment added by
934:(With that said,
916:
893:comment added by
460:comment added by
407:comment added by
365:
330:
329:
326:
325:
322:
321:
251:WikiProject C/C++
183:
182:
66:Assume good faith
43:
1107:
1062:
1049:
1048:
1027:
1011:
1010:
913:
905:
830:
829:
739:
736:
733:
730:
727:
724:
721:
718:
715:
712:
709:
605:
604:
479:
472:
419:
362:
298:importance scale
280:
279:
276:
273:
270:
245:
238:
237:
232:
224:
217:
200:
194:
193:
185:
179:
178:
164:
95:Article policies
16:
1115:
1114:
1110:
1109:
1108:
1106:
1105:
1104:
1065:
1064:
1046:
1045:
1043:
1021:
1006:
1000:
963:
888:
885:
825:
819:
741:
740:
737:
734:
731:
728:
725:
722:
719:
716:
713:
710:
707:
600:
594:
590:
539:
537:Proposed rename
486:"calendar time"
477:
462:195.244.120.156
455:
443:
425:
402:
335:
294:High-importance
277:
274:
271:
268:
267:
231:High‑importance
230:
198:
121:
116:
115:
114:
91:
61:
12:
11:
5:
1113:
1111:
1103:
1102:
1097:
1092:
1087:
1082:
1077:
1067:
1066:
1020:
1017:
1016:
1015:
991:
990:
962:
959:
958:
957:
943:
941:
938:requires that
932:
926:
921:
920:
884:
881:
880:
879:
855:
854:
853:
852:
837:
836:
835:
834:
813:
812:
811:
810:
798:
797:
796:
795:
788:
787:
786:
785:
779:
778:
777:
776:
769:
768:
758:213.131.238.28
753:
752:
747:
746:
706:
704:
703:
695:
694:
685:
684:
683:
682:
674:
671:
667:
661:
660:
646:
645:
644:
643:
633:213.131.238.28
626:
625:
589:
586:
585:
584:
538:
535:
534:
533:
532:
531:
519:accordingly. —
510:
502:
501:
442:
439:
424:
421:
399:
397:
396:
395:
394:
393:
392:
372:
371:
370:
369:
349:
348:
334:
331:
328:
327:
324:
323:
320:
319:
312:
302:
301:
290:
284:
283:
281:
278:C/C++ articles
264:the discussion
246:
234:
233:
225:
213:
212:
206:
195:
181:
180:
118:
117:
113:
112:
107:
102:
93:
92:
90:
89:
82:
77:
68:
62:
60:
59:
48:
39:
38:
35:
34:
28:
13:
10:
9:
6:
4:
3:
2:
1112:
1101:
1098:
1096:
1093:
1091:
1088:
1086:
1083:
1081:
1078:
1076:
1073:
1072:
1070:
1063:
1061:
1057:
1053:
1041:
1039:
1035:
1031:
1026:
1018:
1014:
1009:
1005:
1004:
997:
993:
992:
988:
987:
986:
983:
979:
975:
971:
960:
956:
952:
948:
944:
939:
937:
933:
930:
924:
923:
922:
919:
915:
912:
908:
907:
906:
904:
900:
896:
892:
883:Leap seconds?
882:
878:
874:
870:
865:
861:
857:
856:
850:
846:
841:
840:
839:
838:
833:
828:
824:
823:
817:
816:
815:
814:
807:
802:
801:
800:
799:
792:
791:
790:
789:
783:
782:
781:
780:
773:
772:
771:
770:
767:
763:
759:
755:
754:
749:
748:
743:
742:
701:
697:
696:
691:
687:
686:
679:
675:
672:
668:
665:
664:
663:
662:
657:
653:
648:
647:
642:
638:
634:
630:
629:
628:
627:
624:
620:
616:
611:
610:
609:
608:
603:
599:
598:
587:
583:
579:
575:
571:
567:
566:
565:
564:
560:
556:
552:
551:WP:COMMONNAME
548:
544:
536:
530:
526:
522:
518:
514:
508:
506:
505:
504:
503:
500:
496:
492:
487:
483:
475:
474:
473:
471:
467:
463:
459:
453:
448:
440:
438:
437:
434:
430:
422:
420:
418:
414:
410:
409:184.71.25.218
406:
391:
387:
383:
378:
377:
376:
375:
374:
373:
368:
364:
361:
357:
353:
352:
351:
350:
347:
344:
340:
339:
338:
332:
317:
308:
304:
303:
299:
295:
289:
286:
285:
282:
265:
261:
257:
253:
252:
247:
244:
240:
239:
235:
229:
226:
223:
219:
214:
210:
204:
196:
192:
187:
186:
177:
173:
170:
167:
163:
159:
155:
152:
149:
146:
143:
140:
137:
134:
131:
127:
124:
123:Find sources:
120:
119:
111:
110:Verifiability
108:
106:
103:
101:
98:
97:
96:
87:
83:
81:
78:
76:
72:
69:
67:
64:
63:
57:
53:
52:Learn to edit
49:
46:
41:
40:
37:
36:
32:
26:
22:
18:
17:
1042:
1032:through the
1022:
1002:
995:
974:71.179.41.98
968:— Preceding
964:
961:Completeness
947:Steve Summit
928:
889:— Preceding
886:
848:
845:kernel style
844:
821:
805:
699:
689:
677:
655:
651:
596:
591:
569:
540:
521:Steve Summit
485:
481:
456:— Preceding
444:
426:
403:— Preceding
398:
356:WP:NOT#HOWTO
336:
293:
249:
209:WikiProjects
171:
165:
157:
150:
144:
138:
132:
122:
94:
19:This is the
895:82.139.81.0
756:Au revoir.
382:77.11.26.13
343:a_dergachev
199:Start-class
148:free images
31:not a forum
1085:C articles
1069:Categories
929:typically
927:does not
681:branches.
88:if needed
71:Be polite
21:talk page
1052:PrimeBOT
996:standard
982:contribs
970:unsigned
891:unsigned
723:iov_base
458:unsigned
405:unsigned
56:get help
29:This is
27:article.
1003:Stepho
822:Stepho
751:enough?
732:iov_len
676:Tab is
597:Stepho
296:on the
154:WPÂ refs
142:scholar
940:time_t
925:time_t
869:1exec1
809:worse.
729:size_t
708:struct
700:should
693:style.
659:views:
615:1exec1
574:1exec1
555:1exec1
509:time_t
491:1exec1
480:means
478:time_t
441:time_t
433:RM bot
205:scale.
126:Google
1058:) on
936:Posix
911:intgr
806:looks
711:iovec
656:style
513:Posix
360:intgr
358:. --
269:C/C++
228:C/C++
169:JSTOR
130:books
84:Seek
1056:talk
1008:talk
978:talk
951:talk
899:talk
873:talk
827:talk
762:talk
745:bad.
717:void
678:very
652:sole
637:talk
619:talk
602:talk
578:talk
570:zero
559:talk
549:per
525:talk
495:talk
466:talk
413:talk
386:talk
288:High
258:and
162:FENS
136:news
73:and
1050:by
1040:.
862:or
545:to
484:or
454:)
260:C++
176:TWL
1071::
984:)
980:•
953:)
901:)
875:)
764:)
738:};
690:is
639:)
621:)
580:)
561:)
553:.
527:)
497:)
468:)
415:)
388:)
156:)
54:;
1054:(
976:(
949:(
945:—
897:(
871:(
760:(
735:;
726:;
720:*
714:{
635:(
617:(
576:(
557:(
523:(
493:(
464:(
411:(
384:(
318:.
316:C
300:.
256:C
211::
172:·
166:·
158:·
151:·
145:·
139:·
133:·
128:(
58:.
Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.