Skip to content

Commit

Permalink
Merge branch 'main' into john-upgrade-mbedtls
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmlee101 committed Jul 16, 2024
2 parents 0a1808e + fa080ac commit 1875241
Show file tree
Hide file tree
Showing 6 changed files with 5,450 additions and 3,414 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/bedrock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ jobs:
timeout-minutes: 30
steps:

- name: Install the Mold Linker
uses: rui314/setup-mold@v1

- name: Checkout Bedrock
uses: actions/checkout@v4.1.0

Expand Down
8 changes: 8 additions & 0 deletions libstuff/STime.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "libstuff.h"

#include <cstring>
#include <sys/time.h>

uint64_t STimeNow() {
Expand All @@ -19,6 +20,13 @@ string SComposeTime(const string& format, uint64_t when) {
return string(buf, length);
}

uint64_t STimestampToEpoch(const string& format, const string& timestamp) {
struct tm time;
memset(&time, 0, sizeof(struct tm));
strptime(timestamp.c_str(), format.c_str(), &time);
return mktime(&time);
}

int SDaysInMonth(int year, int month) {
// 30 days hath September...
if (month == 4 || month == 6 || month == 9 || month == 11) {
Expand Down
2 changes: 1 addition & 1 deletion libstuff/libstuff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1769,7 +1769,7 @@ int S_socket(const string& host, bool isTCP, bool isPort, bool isBlocking) {
// There was a problem.
if (result || !resolved) {
freeaddrinfo(resolved);
STHROW("can't resolve host error no#" + result);
STHROW("can't resolve host error no#" + SToStr(result));
}
// Grab the resolved address.
sockaddr_in* addr = (sockaddr_in*)resolved->ai_addr;
Expand Down
1 change: 1 addition & 0 deletions libstuff/libstuff.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ uint64_t STimeNow();
uint64_t STimeThisMorning(); // Timestamp for this morning at midnight GMT
int SDaysInMonth(int year, int month);
string SComposeTime(const string& format, uint64_t when);
uint64_t STimestampToEpoch(const string& format, const string& timestamp);
timeval SToTimeval(uint64_t when);
string SFirstOfMonth(const string& timeStamp, const int64_t& offset = 0);

Expand Down
Loading

0 comments on commit 1875241

Please sign in to comment.