While CFAbsoluteTimeGetDayOfWeek has been deprecated, it’s still available, even on Apple silicon. Consider this:
-
With Xcode 14.1, create a new project from the macOS > Command Line Tool target.
-
Replace the code with that shown below.
-
In the run destination popup, select Any Mac so that it builds both Apple silicon and Intel.
-
Choose Product > Build.
It builds just fine.
I suspect that the problem here is that you’re not linking with the relevant framework, namely CoreFoundation.
Having said that, you really shouldn’t be using CFAbsoluteTimeGetDayOfWeek. It has been deprecated for a long time, and for good reason. This is not the path forward if you want to do calendrical calculations.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
import Foundation
func main() {
print("Hello Cruel World!")
let t: CFAbsoluteTime = 0
CFAbsoluteTimeGetDayOfWeek(t, nil)
}
main()