Skip to content

Instantly share code, notes, and snippets.

@NguyenTatNhac
Created December 16, 2022 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NguyenTatNhac/0577827a92e0a33bc2052c3672312b27 to your computer and use it in GitHub Desktop.
Save NguyenTatNhac/0577827a92e0a33bc2052c3672312b27 to your computer and use it in GitHub Desktop.
bool between(const struct time* begin, const struct time* examined, const struct time* end) {
int bSecond = begin->hour * 60 * 60 + begin->minute * 60 + begin->second;
int xSecond = examined->hour * 60 * 60 + examined->minute * 60 + examined->second;
int eSecond = end->hour * 60 * 60 + end->minute * 60 + end->second;
return xSecond >= bSecond && xSecond <= eSecond;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment