Showing posts with label MacOS X. Show all posts
Showing posts with label MacOS X. Show all posts

Tuesday, February 11, 2020

Converting Between Human Time and Absolute Time in the Shell

This is really more of a note-to-self but it may also be useful for other readers.

Converting between various time zones, including UTC time, is both a pain and error-prone. A better solution is to use absolute time. Thankfully, Unix provides such a time: the so-called Epoch time, which is the integer count of the number of seconds since January 1, 1970.

Timestamps are both very important and often overlooked: the moreso in the context of performance analysis, where time is the zeroth metric. In fact, my preferred title would have been, Death to Time Zones but that choice would probably have made it harder to find the main point here, later on, viz., how to use the Unix epoch time.

Although there are web pages that facilitate such time conversions, there are also shell commands that are often more convenient to use, but not so well known. With that in mind, here are some examples (for future reference) of how to convert between human-time and Unix time.

Examples

The following are the bash shell commands for both MacOS and Linux.

MacOS and BSD

Optionally see the human-readable date-time:

[njg]~% date
Tue Feb 11 10:04:32 PST 2020
Get the Unix integer time for the current date:

[njg]~% date +%s
1581444272
Resolve a Unix epoch integer to date-time:

[njg]~% date -r 1581444272
Tue Feb 11 10:04:32 PST 2020

Linux

Optionally see the human-readable date-time:

[njg]~% date
Tue Feb 11 10:04:32 PST 2020
Get the Unix integer time for the current date:

[njg]~% date +%s
1581444272
Resolve a Unix epoch integer to date-time:

[njg]~% date -d @1581444272
Tue Feb 11 18:04:32 UTC 2020

Friday, October 25, 2013

The Importance of 2 + ε Dimensions: Flat is the Name of the Game

In a 2010 email, I wrote the following about Steve Jobs:
Sent: Mon, May 31, 2010 5:02:32 PM
Subject: Why Jobs has been vindicated on quality

Observation: Jobs has finally been vindicated on his stand over high quality (and premium price, although not as premium as it used to be). Why?

Theory: Jobs has made the computer 2-dimensional.

Data: From the earliest days of the Mac, Jobs preached quality (there's even a video clip with him slagging Gates for failing to understood quality). For 2 decades Jobs was proven wrong, in the sense that customers were not willing to pay a premium for quality, so Apple never garnered more than 4-5% of the PC market.

Tuesday, June 28, 2011

The Backstory on Time-Share Computing

In chapter 4 of my Perl::PDQ book, "Linux Load Average—Take a Load Off" and Appendix B "A Short History of Buffers," I briefly refer to the history of Unix and ultimately Linux via Multics, starting with the original MIT project called CTSS (Compatible Time-sharing System). My purpose there was to point out that the load average metric is the earliest example of O/S performance instrumentation. Naturally then, the following 5-part series in the NYT on the development of time-share computers caught my attention:
These accounts are noteworthy because they are written by the brother of one of the developers (of early email—depending on how you define email) and the author is a journalist, so he interviewed some of the personalities (who are now getting on a bit).

There are also lots of fascinating photos.

Wednesday, February 3, 2010

A4 (ain't just paper anymore): Apple's New Chip

In case you missed it, with the advent of the iPad, Apple Inc. has entered the CPU business. While many pundits are still scratching their heads and wondering, "Who needs a giant iPod Touch?" Chris O'Brian notes:

"For the first time, Apple has built it’s own chip for a product. For years, the company has worked with others, first Motorola and then IBM, to build its processors. But for the iPad, the company debuted its A4 chip. The chip came via its acquistion of P.A. Semi in 2008. Building its own chip reportedly was one of the key reasons Apple was able to bring the cost of the iPad down. But early reviewers have also noted the iPad’s speed at rendering Web pages. The A4 potentially puts Apple in a position to build more of its own chips, and it also sets up a new rivalry against Intel for the mobile computing business."

Apple has built chips before; he means home-grown microprocessor.

Monday, October 26, 2009

This Apple Does Fall Far From The B-Tree

That old adage: the apple doesn't fall far from the tree, doesn't apply to Apple the corporation. According to ArsTechnica today, Apple abruptly abandoned its open-source project to port Sun's ZFS as the filesystem for Mac OS X, on October 23rd.

The speculation is that Sun licensing fees may have been viewed as a roadblock to adoption or possibly there are growing concerns that Oracle's acquisition of Sun could cause other problems. In the meantime, Apple is hiring engineers to build its own advanced filesystem, instead of adopting either ZFS or its Linux derivative BtrFS.

Tuesday, March 24, 2009

Nine-Day NetBooks

I claim the "NetBook" (whatever the hell that really is) will turn out to be a 9-day wonder: less utility then a laptop, too big to put in your pocket. End of story. :-)

Wednesday, March 11, 2009

Treemap Visualization of Disk Volumes

GrandPerspective is a FOSS tool for Mac OS X that provides a treemap visualization of file layout on a disk. I created the treemap below from an 80 GB disk on my G4 towermac, which has both Mac OS X files (left) and WinXP files (right); the latter being a copy from the disk of my recently deceased Sony laptop). It certainly gives new meaning to the term disk blocks.


It's quite striking to see the greater number of larger aggregations of files on the Mac side vs. the many smaller files on the XP side. I guess that's why we don't need to do "defragging" on macs. :-)

Friday, January 30, 2009

PDQ From SourceForge

Thoughly fed up doing mind-numbing company income taxes for 2008 (Yes, I have to do them earlier than most to get my 1099s out to sub-contractors), I decided to take a break and see if I could compile PDQ (Pretty Damn Quick) by downloading it from our SourceForge project onto my new Macbook.

Tuesday, January 6, 2009

Apres MacWorld, an Al MacBook

I'm writing this on my newly purchased Aluminum 13" Macbook---and what a beautiful machine it is. The decision to buy it was made for me by the spontaneous death of my 12" Sony VAIO V505EXP, which has been my trusty mobile workhorse since 2004. I prefer a smaller screen, especially on flights and for working in front of the TV---like this. And now that Macs run Windoze as well, it's a no brainer. I'll move all my Sony VAIO files onto this Macbook (eventually).

Saturday, January 3, 2009

JournalSpace.gone

So, this is Web 2.0? And I'm supposed to put my entire existence on a (black) Cloud!? Do you know who is managing your web services? This is how you might find out.

Part of me still wants to believe it's a slightly premature April Fool hoax. I mean, just look at the filename on that HTML page. But I checked slashdot and it's still there. So, it must be true. :-\ The earlier innuendo (on "Tuesday") that it might have been MacOS X going nutzoid, has now been narrowed to a (the?) sysadm going postal on the database. Can you say, "Secondary storage"?

Friday, December 26, 2008

Laptop Shipments Finally Beat Desktops

As reported in this December 23rd piece by Information Week, the new laptop player hiding in these numbers is the NetBook. A netbook is defined as an ultralight, ultraportable PC with screen sizes 10 inches or less. With no CD/DVD drive and limited storage, prices can be as low as $300. Thanks but, no thanks! just give an iPhone.