Skip to content

Instantly share code, notes, and snippets.

@randomdude999
Last active September 3, 2016 07:40
Show Gist options
  • Save randomdude999/ca30378c3d254fb6ed5c61c24e268b5c to your computer and use it in GitHub Desktop.
Save randomdude999/ca30378c3d254fb6ed5c61c24e268b5c to your computer and use it in GitHub Desktop.
Patch for apt moo. (Apply to apt-private/private-moo.cc, apt version 1.3_rc4)
68c68
< std::cerr << getMooLine() << std::endl;
---
> std::cerr << getMooLine(); // getMooLine already has a newline
166c166
< time_t const timenow = time(NULL);
---
> struct timespec timenow;
168c168,169
< localtime_r(&timenow, &april);
---
> clock_gettime(CLOCK_REALTIME, &timenow);
> localtime_r(&(timenow.tv_sec), &april);
182c183,184
< SuperCow = 1 + (timenow % 4);
---
> // timenow.tv_nsec is in nanosecs, divide by 1mln to get millisecs
> SuperCow = 1 + ((timenow.tv_nsec / 1000000) % 4);
184c186
< SuperCow = 1 + (timenow % 3);
---
> SuperCow = 1 + ((timenow.tv_nsec / 1000000) % 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment