Timeline for Output the Current Time
Current License: CC BY-SA 3.0
16 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 17, 2020 at 9:04 | history | edited | CommunityBot |
Commonmark migration
|
|
Nov 29, 2015 at 12:54 | history | edited | Gamerdog | CC BY-SA 3.0 |
deleted 7 characters in body
|
Nov 29, 2015 at 2:41 | comment | added | user45941 |
You can use %T as the format spec in strftime .
|
|
Nov 29, 2015 at 1:54 | comment | added | Sahil Arora |
I guess you can replace the NULL BY 0 , saving 3 more. Try that out!
|
|
Nov 28, 2015 at 15:18 | history | edited | Gamerdog | CC BY-SA 3.0 |
Even smaller - turns out sleep() is a thing.
|
Nov 28, 2015 at 15:09 | history | edited | Gamerdog | CC BY-SA 3.0 |
shaved off two more bytes
|
Nov 28, 2015 at 15:07 | comment | added | Addison Crump | Huh. Well done, then, +1. | |
Nov 28, 2015 at 14:50 | comment | added | Gamerdog | @VoteToClose It's actually shorter not to. The gettimeofday() syscall doesn't actually return the time of day - as far as I can tell it returns the length of time since the epoch (1/1/1970). strftime() turns that into a readable timestamp based on the system time. This is the shortest I can think to get it while only using C and syscalls. | |
Nov 28, 2015 at 14:48 | history | edited | Addison Crump | CC BY-SA 3.0 |
Did some general tidying. c:
|
Nov 28, 2015 at 14:42 | comment | added | Addison Crump | Ah, another thing - you don't have to cut the string for just the time, so you can just output the entire date time, provided it has the time string required in it. | |
Nov 28, 2015 at 14:39 | comment | added | Addison Crump | ¯\_(ツ)_/¯ I don't really know C, either. I'll let the professionals at that. Welcome again, have an up vote. :D | |
Nov 28, 2015 at 14:39 | history | edited | Gamerdog | CC BY-SA 3.0 |
added 19 characters in body
|
Nov 28, 2015 at 14:37 | comment | added | Gamerdog |
@VoteToClose You were right about the spaces in the #include s. It doesn't look like usleep() accepts 1e6, though - based on how fast it starts spitting out timestamps it just interprets it as 1.
|
|
Nov 28, 2015 at 14:33 | comment | added | Addison Crump |
Welcome to PPCG! Unless I'm mistaken, I believe you can remove the space between #include and <...> . Also, can you use 1e6 instead of 1000000 ?
|
|
Nov 28, 2015 at 14:32 | review | First posts | |||
Nov 28, 2015 at 15:27 | |||||
Nov 28, 2015 at 14:31 | history | answered | Gamerdog | CC BY-SA 3.0 |